Skip to content

Commit

Permalink
Add test for pyproject.toml loading without explicit --cov-config. Ref
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed Mar 19, 2024
1 parent ff50860 commit 93b5047
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_pytest_cov.py
Expand Up @@ -1365,6 +1365,13 @@ def test_basic(no_cover):
exclude_lines =
raise NotImplementedError
"""
PYPROJECTTOML = """
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
'raise NotImplementedError',
]
"""

EXCLUDED_TEST = """
Expand All @@ -1388,6 +1395,14 @@ def test_coveragerc(testdir):
result.stdout.fnmatch_lines([f'test_coveragerc* {EXCLUDED_RESULT}'])


def test_pyproject_toml(testdir):
testdir.makefile('.toml', pyproject=PYPROJECTTOML)
script = testdir.makepyfile(EXCLUDED_TEST)
result = testdir.runpytest('-v', f'--cov={script.dirpath()}', '--cov-report=term-missing', script)
assert result.ret == 0
result.stdout.fnmatch_lines([f'test_pyproject_toml* {EXCLUDED_RESULT}'])


@pytest.mark.skipif('sys.platform == "win32" and platform.python_implementation() == "PyPy"')
def test_coveragerc_dist(testdir):
testdir.makefile('', coveragerc=COVERAGERC)
Expand Down

0 comments on commit 93b5047

Please sign in to comment.