forked from browserbase/stagehand-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·40 lines (34 loc) · 1.17 KB
/
run_tests.sh
File metadata and controls
executable file
·40 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# Run tests with coverage reporting
# Make sure we're in the right directory
cd "$(dirname "$0")"
# Install dev requirements if needed
if [[ -z $(pip3 list | grep pytest) ]]; then
echo "Installing development requirements..."
pip3 install -r requirements-dev.txt
fi
# Install package in development mode if needed
if [[ -z $(pip3 list | grep stagehand) ]]; then
echo "Installing stagehand package in development mode..."
pip3 install -e .
fi
# Run the tests
echo "Running tests with coverage..."
python3 -m pytest tests/ -v --cov=stagehand --cov-report=term --cov-report=html
echo "Tests complete. HTML coverage report is in htmlcov/ directory."
# Check if we should open the report
if [[ "$1" == "--open" || "$1" == "-o" ]]; then
echo "Opening HTML coverage report..."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
open htmlcov/index.html
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux with xdg-open
xdg-open htmlcov/index.html
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
# Windows
start htmlcov/index.html
else
echo "Couldn't automatically open the report. Please open htmlcov/index.html manually."
fi
fi