Skip to content

Commit 783e106

Browse files
Евгений БлиновЕвгений Блинов
authored andcommitted
Update test workflow to use pytest-cov for coverage reporting
1 parent c3962bf commit 783e106

3 files changed

Lines changed: 2 additions & 18 deletions

File tree

.github/workflows/tests_and_coverage.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ jobs:
6262

6363
- name: Run tests and show the branch coverage on the command line
6464
shell: bash
65-
run: |
66-
pth_file="$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')/suby_coverage_process_startup.pth"
67-
printf "import os; os.getenv('COVERAGE_PROCESS_START') and __import__('coverage').process_startup()\n" > "$pth_file"
68-
coverage erase
69-
COVERAGE_PROCESS_START="$PWD/pyproject.toml" coverage run -m pytest -n auto --cache-clear --assert=plain
70-
coverage combine
71-
coverage report -m --fail-under=100 --omit='*tests*'
72-
coverage xml --omit='*tests*'
65+
run: pytest --cov=suby --cov-branch --cov-report=term-missing --cov-report=xml:coverage.xml --cov-fail-under=100 -n auto --cache-clear --assert=plain
7366

7467
- name: Upload coverage to Coveralls
7568
if: runner.os == 'Linux' && matrix.python-version == '3.13'

requirements_dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pytest-xdist==3.6.1; python_version < '3.9'
33
pytest-xdist==3.8.0; python_version >= '3.9'
44
coverage==7.6.1
55
coverage-pyver-pragma==0.4.0
6+
pytest-cov==6.1.1
67
build==1.2.2.post1
78
mypy==1.14.1
89
pytest-mypy-testing==0.1.3

tests/conftest.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
_run_module = importlib.import_module('suby.run')
1010

1111

12-
def pytest_configure(config):
13-
"""Keep coverage enabled for xdist workers, but disable inheritance by child `run(... python -c ...)` subprocesses.
14-
15-
If this hook is removed, every short-lived Python subprocess spawned by the test suite will inherit
16-
`COVERAGE_PROCESS_START`, import coverage from the `.pth` bootstrap, and the parallel coverage run will become
17-
significantly slower again.
18-
"""
19-
if hasattr(config, 'workerinput'):
20-
os.environ.pop('COVERAGE_PROCESS_START', None)
21-
2212

2313
def pytest_ignore_collect(collection_path, config):
2414
"""Skip typing-snippet tests in mutmut's copied test tree, because mutmut is a runtime mutation runner."""

0 commit comments

Comments
 (0)