Skip to content

Commit 93b5047

Browse files
committed
Add test for pyproject.toml loading without explicit --cov-config. Ref #508.
1 parent ff50860 commit 93b5047

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_pytest_cov.py

+15
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,13 @@ def test_basic(no_cover):
13651365
exclude_lines =
13661366
raise NotImplementedError
13671367
"""
1368+
PYPROJECTTOML = """
1369+
[tool.coverage.report]
1370+
# Regexes for lines to exclude from consideration
1371+
exclude_lines = [
1372+
'raise NotImplementedError',
1373+
]
1374+
"""
13681375

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

13901397

1398+
def test_pyproject_toml(testdir):
1399+
testdir.makefile('.toml', pyproject=PYPROJECTTOML)
1400+
script = testdir.makepyfile(EXCLUDED_TEST)
1401+
result = testdir.runpytest('-v', f'--cov={script.dirpath()}', '--cov-report=term-missing', script)
1402+
assert result.ret == 0
1403+
result.stdout.fnmatch_lines([f'test_pyproject_toml* {EXCLUDED_RESULT}'])
1404+
1405+
13911406
@pytest.mark.skipif('sys.platform == "win32" and platform.python_implementation() == "PyPy"')
13921407
def test_coveragerc_dist(testdir):
13931408
testdir.makefile('', coveragerc=COVERAGERC)

0 commit comments

Comments
 (0)