-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·51 lines (43 loc) · 1.49 KB
/
run_tests.sh
File metadata and controls
executable file
·51 lines (43 loc) · 1.49 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
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# Default to running all tests without coverage.
partial_test=0
run_coverage=0
# Check if user explicitly requests coverage
case "$@" in
*--cov*) run_coverage=1 ;;
esac
# If user requests a subset of tests for pytest, note this preference to avoid
# running other tests.
case "$@" in
*-k*) partial_test=1 ;;
esac
if [ "$run_coverage" = 1 ]; then
# Remove --cov from args since pytest will handle coverage via --cov=augur
echo "Running tests with coverage enabled, remove --cov to disable"
filtered_args=$(echo "$*" | sed 's/--cov//g')
coverage_arg='--cov=augur'
# Set env variable COVERAGE_CORE to sysmon for coverage
# This reduces overhead of coverage collection
# But only if Python version >3.14
if python3 -c 'import sys; print(sys.version_info >= (3, 14))' | grep -q True; then
echo "Using sysmon for coverage to reduce overhead"
export COVERAGE_CORE=sysmon
else
echo "Using default coverage collection method"
fi
else
# Default to no coverage
echo "Running tests without coverage, use --cov to enable"
filtered_args="$*"
coverage_arg='--no-cov'
fi
echo "Running unit tests and doctests with pytest"
python3 -m pytest $coverage_arg $filtered_args
# Only run functional tests if we are not running a subset of tests for pytest.
if [ "$partial_test" = 0 ]; then
echo "Running functional tests with cram"
cram tests/
else
echo "Skipping functional tests when running a subset of unit tests"
fi
exit $?