Skip to content

Commit 8b5c6b4

Browse files
committed
tests: pytest-cov -> coverage conversion
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 7cf3e5c commit 8b5c6b4

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test = [
5454
"build[uv, virtualenv]",
5555
"filelock >= 3",
5656
"pytest >= 6.2.4",
57-
"pytest-cov >= 2.12",
57+
"coverage[toml]>=5.1",
5858
"pytest-mock >= 2",
5959
"pytest-rerunfailures >= 9.1",
6060
"pytest-xdist >= 1.34",
@@ -100,6 +100,7 @@ exclude_also = [
100100
'^\s*raise NotImplementedError\b',
101101
"if typing.TYPE_CHECKING:",
102102
]
103+
show_missing = true
103104

104105
[tool.coverage.paths]
105106
build = [

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def local_pip(monkeypatch):
8080

8181
@pytest.fixture(autouse=True)
8282
def avoid_constraints(monkeypatch):
83-
monkeypatch.delenv("PIP_CONSTRAINT", raising=False)
84-
monkeypatch.delenv("UV_CONSTRAINT", raising=False)
83+
monkeypatch.delenv('PIP_CONSTRAINT', raising=False)
84+
monkeypatch.delenv('UV_CONSTRAINT', raising=False)
8585

8686

8787
@pytest.fixture(autouse=True, params=[False])

tox.ini

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ set_env =
2828
PYTHONWARNDEFAULTENCODING = 1
2929
TEST_STATUS_DIR = {envtmpdir}
3030
commands =
31-
pytest -ra --cov --cov-config pyproject.toml \
32-
--cov-report=html:{envdir}/htmlcov --cov-context=test \
33-
--cov-report=xml:{toxworkdir}/coverage.{envname}.xml {posargs:-n auto}
31+
coverage run --context=test --data-file={envdir}/.coverage -m pytest -ra {posargs:-n auto}
32+
coverage html --data-file={envdir}/.coverage --directory={envdir}/htmlcov
33+
coverage xml --data-file={envdir}/.coverage -o {toxworkdir}/coverage.{envname}.xml
34+
coverage report --data-file{envdir}/.coverage
3435

3536
[testenv:fix]
3637
description = run static analysis and style checks
@@ -100,8 +101,8 @@ pass_env =
100101
DIFF_AGAINST
101102
set_env =
102103
commands =
103-
coverage combine {toxworkdir}
104-
coverage report --skip-covered --show-missing -i
104+
coverage combine {envdir}/*
105+
coverage report --skip-covered -i
105106
coverage xml -o {toxworkdir}/coverage.xml -i
106107
coverage html -d {toxworkdir}/htmlcov -i
107108
python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml

0 commit comments

Comments
 (0)