Skip to content

Commit c89a93f

Browse files
committed
Replace coverage with pytest-cov plugin for code coverage
pytest-cov is a coverage plugin for pytest and provides extra capability on top of coverage run. Signed-off-by: Martin Hickey <[email protected]>
1 parent fb906ac commit c89a93f

File tree

2 files changed

+20
-39
lines changed

2 files changed

+20
-39
lines changed

.gitignore

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
*.egg-info
2-
*.pyc
1+
# Distribution / packaging
2+
build/
3+
dist/
4+
*.egg-info/
5+
6+
# Unit test / coverage reports
37
__pycache__
8+
htmlcov/
9+
.tox/
410
.coverage
511
.coverage.*
612
durations/*
713
coverage*.xml
8-
dist
9-
htmlcov
10-
test
14+
qcfg.json
1115

1216
# IDEs
1317
.vscode/
@@ -23,23 +27,9 @@ venv/
2327
# Mac personalization files
2428
*.DS_Store
2529

26-
# Tox envs
27-
.tox
28-
29-
# Backup files and folders
30-
*.bkp
31-
*.bkp.*
32-
*bkp*
33-
34-
# Build output
35-
/build/lib/
36-
3730
# Generated by setuptools_scm
3831
/fms_mo/_version.py
3932

40-
# Generated by tests
41-
qcfg.json
42-
4333
# Generated by spelling check
4434
dictionary.dic
4535

tox.ini

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,28 @@ envlist = ruff, lint, spellcheck, unit
33
minversion = 4.4
44

55
[testenv]
6-
description = run tests (unit)
6+
description = run tests (unit, unitcov)
77
extras =
88
dev
99
package = wheel
1010
wheel_build_env = pkg
1111
deps =
1212
pytest
13+
pytest-cov
14+
pytest-html
1315
commands =
14-
unit: {basepython} -m pytest {posargs:tests}
16+
unit: {envpython} -m pytest {posargs:tests}
17+
unitcov: {envpython} -W error::UserWarning -m pytest --cov=fms_mo --cov-report term --cov-report=html:coverage-{env_name} --cov-report=xml:coverage-{env_name}.xml --html=durations/{env_name}.html {posargs:tests -m "not (examples or slow)"}
1518

1619
[testenv:py3]
1720
basepython = python3.11
1821

1922
[testenv:unit]
2023
basepython = {[testenv:py3]basepython}
2124

25+
[testenv:unitcov]
26+
basepython = {[testenv:py3]basepython}
27+
2228
[testenv:lint]
2329
description = lint with pylint
2430
basepython = {[testenv:py3]basepython}
@@ -68,23 +74,8 @@ commands =
6874
{envpython} -m pyspelling --config {toxinidir}/.spellcheck.yml --spellchecker aspell
6975
allowlist_externals = sh
7076

71-
[testenv:coverage]
72-
description = report unit test coverage
73-
deps =
74-
coverage
75-
pytest
76-
genbadge[coverage]
77-
commands =
78-
coverage run \
79-
--omit=*/_version.py \
80-
--source=fms_mo \
81-
--module pytest tests/
82-
coverage report -m
83-
coverage xml
84-
genbadge coverage -s -i coverage.xml
85-
8677
[gh]
8778
python =
88-
3.11 = 3.11
89-
3.10 = 3.10
90-
3.9 = 3.9
79+
3.11 = 3.11-{unitcov}
80+
3.10 = 3.10-{unitcov}
81+
3.9 = 3.9-{unitcov}

0 commit comments

Comments
 (0)