diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 2049ef7..bd9df38 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -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 = """ @@ -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)