diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-08-05 05:19:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-05 05:19:54 -0700 |
commit | 602e2106edfe437adf56bced4da2e09eb32ca765 (patch) | |
tree | 17ae7ebe1f7b8f61032aa69fce11a8111463fb4e /tests/test_config.py | |
parent | 57a691f15dc8296f91ec1e321d3ed53e165a1f10 (diff) | |
download | python-coveragepy-git-602e2106edfe437adf56bced4da2e09eb32ca765.tar.gz |
feat: unrecognized options are now a warning rather than error. #1035 (#1206)
Because they are warnings issued while parsing the configuration file, it's not
possible to suppress them with the coverage configuration.
Diffstat (limited to 'tests/test_config.py')
-rw-r--r-- | tests/test_config.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index bf9cb4a5..9e126827 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -10,7 +10,7 @@ import pytest import coverage from coverage.config import HandyConfigParser -from coverage.exceptions import CoverageException +from coverage.exceptions import CoverageException, CoverageWarning from tests.coveragetest import CoverageTest, UsingModulesMixin from tests.helpers import without_module @@ -392,7 +392,7 @@ class ConfigTest(CoverageTest): xyzzy = 17 """) msg = r"Unrecognized option '\[run\] xyzzy=' in config file .coveragerc" - with pytest.raises(CoverageException, match=msg): + with pytest.warns(CoverageWarning, match=msg): _ = coverage.Coverage() def test_unknown_option_toml(self): @@ -401,7 +401,7 @@ class ConfigTest(CoverageTest): xyzzy = 17 """) msg = r"Unrecognized option '\[tool.coverage.run\] xyzzy=' in config file pyproject.toml" - with pytest.raises(CoverageException, match=msg): + with pytest.warns(CoverageWarning, match=msg): _ = coverage.Coverage() def test_misplaced_option(self): @@ -410,7 +410,7 @@ class ConfigTest(CoverageTest): branch = True """) msg = r"Unrecognized option '\[report\] branch=' in config file .coveragerc" - with pytest.raises(CoverageException, match=msg): + with pytest.warns(CoverageWarning, match=msg): _ = coverage.Coverage() def test_unknown_option_in_other_ini_file(self): @@ -418,8 +418,8 @@ class ConfigTest(CoverageTest): [coverage:run] huh = what? """) - msg = (r"Unrecognized option '\[coverage:run\] huh=' in config file setup.cfg") - with pytest.raises(CoverageException, match=msg): + msg = r"Unrecognized option '\[coverage:run\] huh=' in config file setup.cfg" + with pytest.warns(CoverageWarning, match=msg): _ = coverage.Coverage() def test_exceptions_from_missing_things(self): |