Skip to content

Commit 04cefd8

Browse files
committed
test(coverage): make coverage consistent and reproducible
1 parent 9ea980f commit 04cefd8

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
python -m pip install poetry poetry-dynamic-versioning
6767
poetry install --with dev,docs -v
6868
- name: Run pytest
69-
run: poetry run poe test --cov=./ --cov-report=xml -ra .
69+
run: poetry run poe coverage
7070
- name: Upload coverage to Codecov
7171
continue-on-error: true
7272
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pip-wheel-metadata
5555
# Tests artifacts
5656
.coverage*
5757
htmlcov/
58+
coverage.xml
5859

5960
# macOS
6061
.DS_Store

pyproject.toml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ script = "devtasks:clean"
8181
help = "remove build/python artifacts"
8282

8383
[tool.poe.tasks.coverage]
84-
cmd = "pytest --cov-report html --cov copier copier tests"
85-
help = "generate an HTML report of the coverage"
84+
cmd = "pytest -p pytest_cov --cov --cov-report=html --cov-report=xml --cov-append"
85+
help = "generate an HTML+XML report of the coverage"
8686

8787
[tool.poe.tasks.dev-setup]
8888
script = "devtasks:dev_setup"
@@ -128,10 +128,23 @@ add_ignore = ["D105", "D107"]
128128

129129
[tool.pytest.ini_options]
130130
addopts = "-n auto -ra"
131+
testpaths = [
132+
"copier/",
133+
"tests/",
134+
]
131135
markers = [
132136
"impure: needs network or is not 100% reproducible"
133137
]
134138

139+
[tool.coverage.run]
140+
source = [
141+
"copier/",
142+
"tests/",
143+
]
144+
omit = [
145+
"*/demo*/*",
146+
]
147+
135148
[tool.commitizen]
136149
annotated_tag = true
137150
changelog_incremental = true

0 commit comments

Comments
 (0)