summaryrefslogtreecommitdiff
path: root/tests
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
commit65f8a80beb2373a3eaaa9b509451abf56155b332 (patch)
treed16afb85de70333e6f68cc2f8801c18a78bfeb6a /tests
parentc491c93d3f37d070cf2997f78d3e9cc3e83beac9 (diff)
downloadpython-coveragepy-65f8a80beb2373a3eaaa9b509451abf56155b332.tar.gz
Fail on unrecognized configuration options. #386
Diffstat (limited to 'tests')
-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 2b32507..6873e85 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."""