Skip to content

Commit c826c48

Browse files
authored
Support newer python versions and pytest args for tests. (#283)
1 parent 5515283 commit c826c48

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

test/run.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#!/bin/bash
22

3+
# Usage (from parent dir of this dir):
4+
# [PY_VERSION=<python_version>] test/run.sh [optional pytest arg]
5+
#
6+
# Examples:
7+
# Run all tests:
8+
# test/run.sh
9+
#
10+
# Run only tests in test_parameters.py
11+
# Include INFO logging messages in the output, i.e. all compilation messages.
12+
# test/run.sh --log-cli-level=INFO test_parameters.py
13+
#
14+
# Same but use python 3.13
15+
# PY_VERSION=3.13 test/run.sh --log-cli-level=INFO test_parameters.py
16+
317
set -e
418

519
cd "$(dirname "$0")"
@@ -15,7 +29,8 @@ if exists ccache; then
1529
fi
1630

1731
# Initialize venv
18-
python3 -m venv .venv
32+
_PYTHON="python${PY_VERSION:-3.11}"
33+
"$_PYTHON" -m venv .venv
1934
source .venv/bin/activate
2035

2136
# Install
@@ -24,9 +39,9 @@ python -m pip install -e ..
2439
python -m pip install -r requirements.txt pytest-parallel
2540

2641
# Run unit tests while collecting coverage
27-
pytest --cov=systemrdl
42+
pytest --cov=systemrdl "$@"
2843
export SYSTEMRDL_DISABLE_ACCELERATOR=1
29-
pytest
44+
pytest "$@"
3045

3146
# Generate coverage report
3247
coverage html -i -d htmlcov

0 commit comments

Comments
 (0)