Skip to content

Commit cea6f9e

Browse files
committed
add coverage runner
1 parent afb7e2b commit cea6f9e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

run_coverage.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# This script runs the test suite and checks that code coverage has not decreased
4+
# relative to the main branch. It also generates an HTML coverage report.
5+
6+
# Uninstall numba to avoid issues with coverage measurement
7+
python -m pip install -q -e .[dev]
8+
python -m pip uninstall -y numba
9+
10+
# Get current coverage
11+
coverage run -m unittest discover ./tests
12+
coverage report > new_coverage.tmp
13+
current_coverage=$(coverage report --precision=7 --format=total)
14+
echo "Coverage: $current_coverage"
15+
16+
# Generate HTML coverage report
17+
coverage html -d htmlcov
18+
19+
# Reinstall numba, clean up temporary files
20+
python -m pip install -q -e .[dev]
21+
rm new_coverage.tmp
22+
echo "Numba reinstalled:"
23+
pip freeze | grep numba
24+
25+
26+
# Open the HTML coverage report in the default web browser if on macOS
27+
if [[ "$OSTYPE" == "darwin"* ]]; then
28+
open "htmlcov/index.html"
29+
fi

0 commit comments

Comments
 (0)