Skip to content

Commit 340eca0

Browse files
Simplify the coverage configuration (#169)
* Simplify the coverage configuration * chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Restore allowed, shared --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b76a261 commit 340eca0

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,4 @@ cython_debug/
168168
# Version created and populated by setuptools_scm
169169
/src/*/_version.py
170170

171-
# Coverage files
172-
*.lcov
173-
174171
.DS_Store

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"editor.formatOnSave": true
1212
},
1313
"flake8.importStrategy": "fromEnvironment",
14-
"markiscodecoverage.searchCriteria": "coverage.lcov",
14+
"markiscodecoverage.searchCriteria": ".coverage/lcov.info",
1515
"mypy-type-checker.args": ["--config-file=${workspaceFolder}/pyproject.toml"],
1616
"mypy-type-checker.importStrategy": "fromEnvironment",
1717
"mypy-type-checker.preferDaemon": true,

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ homepage = "https://github.com/ansible/ansible-dev-environment"
4141
repository = "https://github.com/ansible/ansible-dev-environment"
4242

4343
[tool.coverage.report]
44+
ignore_errors = true
4445
exclude_lines = ["if TYPE_CHECKING:", "pragma: no cover"]
4546
fail_under = 72
4647
show_missing = true

tox.ini

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pass_env =
2525
TERM
2626
USER
2727
set_env =
28+
COVERAGE_COMBINED = {envdir}/.coverage
2829
COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
2930
COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml
3031
FORCE_COLOR = 1
@@ -36,12 +37,10 @@ commands_pre =
3637
commands =
3738
python -c 'import pathlib; pathlib.Path("{env_site_packages_dir}/cov.pth").write_text("import coverage; coverage.process_startup()")'
3839
coverage run -m pytest {posargs:-n auto}
39-
{py,py310,py311,py312,py313}: sh -c " \
40-
coverage combine -q --data-file={envdir}/.coverage {envdir}/.coverage.* && \
41-
coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml --ignore-errors --fail-under=0 && \
42-
COVERAGE_FILE={envdir}/.coverage coverage lcov --fail-under=0 --ignore-errors -q && \
43-
COVERAGE_FILE={envdir}/.coverage coverage report --ignore-errors \
44-
"
40+
coverage combine -q --data-file={env:COVERAGE_COMBINED}
41+
coverage xml --data-file={env:COVERAGE_COMBINED} -o {envdir}/coverage.xml --fail-under=0
42+
coverage lcov --data-file={env:COVERAGE_COMBINED} -o {toxinidir}/.coverage/lcov.info --fail-under=0
43+
coverage report --data-file={env:COVERAGE_COMBINED}
4544
allowlist_externals =
4645
git
4746
rm
@@ -65,9 +64,7 @@ deps =
6564
set_env =
6665
commands =
6766
rm -rfv {toxinidir}/dist/
68-
python -m build \
69-
--outdir {toxinidir}/dist/ \
70-
{toxinidir}
67+
python -m build --outdir {toxinidir}/dist/ {toxinidir}
7168
sh -c "python -m twine check --strict {toxinidir}/dist/*"
7269

7370
[testenv:docs]

0 commit comments

Comments
 (0)