summaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-07-27 20:31:00 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-07-27 20:31:00 -0400
commit7470fe559f2c1fa0c6c87365f115f27c6a4d6ff7 (patch)
treec196528b61f50c4b961cc7be7000138e9a60ce3a /tests/test_config.py
parent5e944cc789a6f068b8ce4fbc255e4d9bfcd72c5f (diff)
downloadpython-coveragepy-git-7470fe559f2c1fa0c6c87365f115f27c6a4d6ff7.tar.gz
Fail on unrecognized configuration options. #386
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 2b325073..6873e85d 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -182,6 +182,33 @@ class ConfigTest(CoverageTest):
with self.assertRaises(CoverageException):
_ = cov.config["no_such.plugin:foo"]
+ def test_unknown_option(self):
+ self.make_file(".coveragerc", """\
+ [run]
+ xyzzy = 17
+ """)
+ msg = r"Unrecognized option '\[run\] xyzzy=' in config file .coveragerc"
+ with self.assertRaisesRegex(CoverageException, msg):
+ _ = coverage.Coverage()
+
+ def test_misplaced_option(self):
+ self.make_file(".coveragerc", """\
+ [report]
+ branch = True
+ """)
+ msg = r"Unrecognized option '\[report\] branch=' in config file .coveragerc"
+ with self.assertRaisesRegex(CoverageException, msg):
+ _ = coverage.Coverage()
+
+ def test_unknown_option_in_other_ini_file(self):
+ self.make_file("setup.cfg", """\
+ [coverage:run]
+ huh = what?
+ """)
+ msg = r"Unrecognized option '\[coverage:run\] huh=' in config file setup.cfg"
+ with self.assertRaisesRegex(CoverageException, msg):
+ _ = coverage.Coverage()
+
class ConfigFileTest(CoverageTest):
"""Tests of the config file settings in particular."""