-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·37 lines (31 loc) · 1010 Bytes
/
Copy pathrun_tests.sh
File metadata and controls
executable file
·37 lines (31 loc) · 1010 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
35
36
37
#!/bin/bash
#
# Runs the python-javaobj test suite for the current Python interpreter.
#
# Used both inside the per-version containers driven by
# run_tests_containers.sh, and directly in CI on the runner. javaobj.v3
# requires Python 3.12+, so it (and its tests) are skipped below that version,
# matching the compatibility table in README.md.
#
set -uo pipefail
echo "Installing dependencies..."
python -m pip install --upgrade pip
pip install pytest coverage || exit 1
if [ -f requirements.txt ]; then
pip install -r requirements.txt || exit 1
fi
python_supports_v3() {
python -c 'import sys; sys.exit(0 if sys.version_info >= (3, 12) else 1)'
}
if python_supports_v3
then
echo "Python 3.12+: running the full suite (v1, v2, v3)..."
coverage run -m pytest
rc=$?
else
echo "Python < 3.12: javaobj.v3 is unsupported, skipping it and its tests..."
coverage run --omit='javaobj/v3/*,tests/test_v3.py' -m pytest --ignore=tests/test_v3.py
rc=$?
fi
coverage report
exit "$rc"