-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_tests.sh
More file actions
34 lines (29 loc) · 867 Bytes
/
run_tests.sh
File metadata and controls
34 lines (29 loc) · 867 Bytes
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
# Run tests with coverage ONLY (no XML, no durations), showing pytest’s usual summary.
# It also overrides any configured addopts (e.g. durations/xml) via `-o addopts=`.
#
# Usage:
# bash scripts/run_tests.sh
set -Eeuo pipefail
# Pick test paths
if [[ $# -ge 1 ]]; then
TEST_PATHS=("$@")
else
TEST_PATHS=(tests)
fi
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
RUN_PREFIX=""
if command -v poetry >/dev/null 2>&1 && [[ -f "$REPO_ROOT/pyproject.toml" ]]; then
RUN_PREFIX="poetry run"
fi
# Headless backend if plots are generated during tests
export MPLBACKEND="${MPLBACKEND:-Agg}"
cd "$REPO_ROOT"
# Run pytest with coverage summary in terminal, no xml, no durations,
# and wipe any addopts coming from config files.
$RUN_PREFIX pytest \
-o addopts= \
--cov=src \
--cov-report=term \
--disable-warnings \
-q \
"${TEST_PATHS[@]}"