Skip to content

Commit f416943

Browse files
committed
Add script to run all tests
1 parent 622010d commit f416943

File tree

3 files changed

+52
-14
lines changed

3 files changed

+52
-14
lines changed

.github/workflows/test-package.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
runs-on: ubuntu-latest
99
timeout-minutes: 5
1010
strategy:
11-
max-parallel: 6
11+
max-parallel: 7
1212
matrix:
13-
python-version: ['3.10', '3.11', '3.12', '3.13', 'pypy-3.10', 'pypy-3.11']
13+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.10', 'pypy-3.11']
1414

1515
steps:
1616
- uses: actions/checkout@v5
@@ -23,14 +23,13 @@ jobs:
2323
python -m pip install --upgrade pip
2424
pip install .[tests]
2525
- name: Lint with flake8
26-
if: matrix.python-version == '3.13'
26+
if: matrix.python-version == '3.14'
2727
run: |
2828
flake8 webware --count --exit-zero --statistics
2929
- name: Lint with pylint
30-
if: matrix.python-version == '3.13'
30+
if: matrix.python-version == '3.14'
3131
run: |
3232
pylint webware
3333
- name: Run all unit tests
3434
run: |
35-
cd webware
36-
python -m unittest discover -fv -p Test*.py
35+
python run_tests.py

run_tests.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!.venv/bin/python3
2+
3+
"""Run all unit tests for Webware for Python 3.
4+
5+
Essentially equivalent to the following commands:
6+
7+
cd webware
8+
python -m unittest discover -fv -p "Test*.py"
9+
10+
Output is sent to stdout instead of stderr,
11+
so that not all appears in red color when using tox.
12+
"""
13+
14+
import sys
15+
import os
16+
import unittest
17+
18+
19+
def main():
20+
"""Run all unit tests for Webware for Python 3."""
21+
root_dir = os.path.dirname(os.path.abspath(__file__))
22+
webware_path = os.path.join(root_dir, "webware")
23+
if webware_path not in sys.path:
24+
sys.path.insert(0, webware_path)
25+
26+
loader = unittest.TestLoader()
27+
suite = loader.discover(
28+
start_dir='webware',
29+
pattern='Test*.py'
30+
)
31+
runner = unittest.TextTestRunner(
32+
stream=sys.stdout,
33+
verbosity=2
34+
)
35+
result = runner.run(suite)
36+
37+
sys.exit(not result.wasSuccessful())
38+
39+
40+
if __name__ == "__main__":
41+
main()

tox.ini

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
[tox]
2-
envlist = py3{10,11,12,13,14rc2}, pypy3{10,11}, flake8, pylint, docs, manifest
2+
envlist = py3{10,11,12,13,14}, pypy3{10,11}, flake8, pylint, docs, manifest
33

44
[testenv:flake8]
5-
basepython = python3.13
5+
basepython = python3.14
66
deps = flake8>=7,<8
77
commands =
88
flake8 webware
99

1010
[testenv:pylint]
11-
basepython = python3.13
11+
basepython = python3.14
1212
deps = pylint>=3,<4
1313
commands =
1414
pylint webware
1515

1616
[testenv:docs]
17-
basepython = python3.13
17+
basepython = python3.14
1818
extras =
1919
docs
2020
commands =
2121
sphinx-build -b html -nEW docs docs/_build/html
2222

2323
[testenv:manifest]
24-
basepython = python3.13
24+
basepython = python3.14
2525
deps = check-manifest>=0.50
2626
commands =
2727
check-manifest -v
2828

2929
[testenv]
30-
setenv =
31-
PYTHONPATH = {toxinidir}/webware
3230
extras =
3331
tests
3432
commands =
35-
python -m unittest discover -fv -p Test*.py
33+
python run_tests.py

0 commit comments

Comments
 (0)