Skip to content

Commit a945180

Browse files
committed
Add coverage reporting to tox environments and fix paver test command
- Add pytest-cov to all tox environments - Configure all pytest commands to generate coverage reports (term + html) - Use --cov-append for environments with multiple test runs - Update paver test command to run tox instead of pytest directly This fixes the issue where 'paver test' failed due to conflicting framework dependencies, and enables automatic coverage reporting for all test runs.
1 parent c659999 commit a945180

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

pavement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def default():
1010

1111
@task
1212
def test():
13-
sh("pytest --cov=hirefire_resource --cov-report=html tests/")
13+
sh("tox")
1414

1515

1616
@task

tox.ini

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ envlist =
66
[testenv]
77
deps =
88
pytest~=7.0
9+
pytest-cov~=4.0
910
pytest-mock~=2.0
1011
pytest-asyncio<1
1112
freezegun~=1.0
@@ -14,11 +15,11 @@ deps =
1415

1516
[testenv:py{39,310,311,312}-core]
1617
commands =
17-
pytest tests/hirefire_resource/test_configuration.py
18-
pytest tests/hirefire_resource/test_hirefire.py
19-
pytest tests/hirefire_resource/test_version.py
20-
pytest tests/hirefire_resource/test_web.py
21-
pytest tests/hirefire_resource/test_worker.py
18+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/test_configuration.py
19+
pytest --cov=hirefire_resource --cov-append --cov-report=term --cov-report=html tests/hirefire_resource/test_hirefire.py
20+
pytest --cov=hirefire_resource --cov-append --cov-report=term --cov-report=html tests/hirefire_resource/test_version.py
21+
pytest --cov=hirefire_resource --cov-append --cov-report=term --cov-report=html tests/hirefire_resource/test_web.py
22+
pytest --cov=hirefire_resource --cov-append --cov-report=term --cov-report=html tests/hirefire_resource/test_worker.py
2223

2324
[testenv:py{39,310,311,312}-django4]
2425
deps =
@@ -27,8 +28,8 @@ deps =
2728
pytest-django~=4.0
2829
starlette<1
2930
commands =
30-
pytest tests/hirefire_resource/middleware/test_wsgi_django.py
31-
pytest tests/hirefire_resource/middleware/test_asgi_django.py
31+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_wsgi_django.py
32+
pytest --cov=hirefire_resource --cov-append --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_asgi_django.py
3233

3334
[testenv:py{39,310,311,312}-django3]
3435
deps =
@@ -37,43 +38,43 @@ deps =
3738
pytest-django~=4.0
3839
starlette<1
3940
commands =
40-
pytest tests/hirefire_resource/middleware/test_wsgi_django.py
41-
pytest tests/hirefire_resource/middleware/test_asgi_django.py
41+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_wsgi_django.py
42+
pytest --cov=hirefire_resource --cov-append --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_asgi_django.py
4243

4344
[testenv:py{39,310,311,312}-flask3]
4445
deps =
4546
{[testenv]deps}
4647
flask~=3.0
4748
commands =
48-
pytest tests/hirefire_resource/middleware/test_wsgi_flask.py
49+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_wsgi_flask.py
4950

5051
[testenv:py{39,310,311,312}-flask2]
5152
deps =
5253
{[testenv]deps}
5354
flask~=2.0
5455
commands =
55-
pytest tests/hirefire_resource/middleware/test_wsgi_flask.py
56+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_wsgi_flask.py
5657

5758
[testenv:py{39,310,311,312}-quart]
5859
deps =
5960
{[testenv]deps}
6061
quart<1
6162
commands =
62-
pytest tests/hirefire_resource/middleware/test_asgi_quart.py
63+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_asgi_quart.py
6364

6465
[testenv:py{39,310,311,312}-fastapi]
6566
deps =
6667
{[testenv]deps}
6768
fastapi<1
6869
commands =
69-
pytest tests/hirefire_resource/middleware/test_asgi_fast_api.py
70+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_asgi_fast_api.py
7071

7172
[testenv:py{39,310,311,312}-starlette]
7273
deps =
7374
{[testenv]deps}
7475
starlette<1
7576
commands =
76-
pytest tests/hirefire_resource/middleware/test_asgi_starlette.py
77+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/middleware/test_asgi_starlette.py
7778

7879
[testenv:py{39,310,311,312}-celery]
7980
deps =
@@ -82,12 +83,12 @@ deps =
8283
amqp~=5.0
8384
celery~=5.0
8485
commands =
85-
pytest tests/hirefire_resource/macro/test_celery.py
86+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/macro/test_celery.py
8687

8788
[testenv:py{39,310,311,312}-rq]
8889
deps =
8990
{[testenv]deps}
9091
redis~=5.0
9192
rq~=1.0
9293
commands =
93-
pytest tests/hirefire_resource/macro/test_rq.py
94+
pytest --cov=hirefire_resource --cov-report=term --cov-report=html tests/hirefire_resource/macro/test_rq.py

0 commit comments

Comments
 (0)