Skip to content

Commit

Permalink
test(coverage): make coverage consistent and reproducible
Browse files Browse the repository at this point in the history
  • Loading branch information
noirbizarre committed Oct 29, 2023
1 parent 9ea980f commit 04cefd8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
python -m pip install poetry poetry-dynamic-versioning
poetry install --with dev,docs -v
- name: Run pytest
run: poetry run poe test --cov=./ --cov-report=xml -ra .
run: poetry run poe coverage
- name: Upload coverage to Codecov
continue-on-error: true
uses: codecov/codecov-action@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pip-wheel-metadata
# Tests artifacts
.coverage*
htmlcov/
coverage.xml

# macOS
.DS_Store
Expand Down
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ script = "devtasks:clean"
help = "remove build/python artifacts"

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

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

[tool.pytest.ini_options]
addopts = "-n auto -ra"
testpaths = [
"copier/",
"tests/",
]
markers = [
"impure: needs network or is not 100% reproducible"
]

[tool.coverage.run]
source = [
"copier/",
"tests/",
]
omit = [
"*/demo*/*",
]

[tool.commitizen]
annotated_tag = true
changelog_incremental = true
Expand Down

0 comments on commit 04cefd8

Please sign in to comment.