summaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-10-11 22:12:28 -0400
committerNed Batchelder <ned@nedbatchelder.com>2014-10-11 22:12:28 -0400
commit2e63e41be0774e51b7683457f31500d99c75c9f1 (patch)
tree40ae7e59bfed319b3e94fa0d3390f53ddd9d9bc7 /tests/test_config.py
parentad511c44579da8e9dc78926d8656e438dbb15064 (diff)
downloadpython-coveragepy-git-2e63e41be0774e51b7683457f31500d99c75c9f1.tar.gz
Config tweaking applies to plugin options also
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 109a2fbc..232d2289 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -136,6 +136,32 @@ class ConfigTest(CoverageTest):
self.assertFalse(cov.config["run:branch"])
self.assertEqual(cov.config["run:data_file"], "fooey.dat")
+ def test_tweak_error_checking(self):
+ # Trying to set an unknown config value raises an error.
+ cov = coverage.coverage()
+ with self.assertRaises(CoverageException):
+ cov.config["run:xyzzy"] = 12
+ with self.assertRaises(CoverageException):
+ cov.config["xyzzy:foo"] = 12
+ with self.assertRaises(CoverageException):
+ _ = cov.config["run:xyzzy"]
+ with self.assertRaises(CoverageException):
+ _ = cov.config["xyzzy:foo"]
+
+ def test_tweak_plugin_options(self):
+ # Plugin options have a more flexible syntax.
+ cov = coverage.coverage()
+ cov.config["run:plugins"] = ["fooey.plugin", "xyzzy.coverage.plugin"]
+ cov.config["fooey.plugin:xyzzy"] = 17
+ cov.config["xyzzy.coverage.plugin:plugh"] = ["a", "b"]
+ with self.assertRaises(CoverageException):
+ cov.config["no_such.plugin:foo"] = 23
+
+ self.assertEqual(cov.config["fooey.plugin:xyzzy"], 17)
+ self.assertEqual(cov.config["xyzzy.coverage.plugin:plugh"], ["a", "b"])
+ with self.assertRaises(CoverageException):
+ _ = cov.config["no_such.plugin:foo"]
+
class ConfigFileTest(CoverageTest):
"""Tests of the config file settings in particular."""