Debian Codegraph @

run_tests.sh

raw
1 #!/bin/bash
2
3 coverage="false"
4
5 for i in "$@"; do
6 case "$i" in
7 --coverage | -c)
8 coverage="true"
9 shift
10 ;;
11 *)
12 break
13 ;;
14 esac
15 done
16
17 declare -a CMD
18 if ${coverage}; then
19 CMD=("python3-coverage" "run")
20 else
21 CMD=("python3" "-B")
22 fi
23 # Args: discover every tests/*_test.py, matching pytest's collection so the
24 # two runners stay in sync (a hardcoded list drifts as tests are renamed/added).
25 CMD+=("-m" "unittest" "discover" "-s" "tests" "-p" "*_test.py")
26
27 "${CMD[@]}"
28
29 if ${coverage}; then
30 python3-coverage report -m
31 fi