summaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-08-02 12:51:14 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-08-02 12:51:14 -0400
commit532ca16b158b8e8ffb8857237a801ec7e641bf46 (patch)
tree0cfbeedffe34378a1f5149a0bf05362dc8b3739b /tests/test_config.py
parent959447537d8d8f4d91f5bf25b810e49bdaffddf6 (diff)
downloadpython-coveragepy-git-532ca16b158b8e8ffb8857237a801ec7e641bf46.tar.gz
Change the coverage.config item-access syntax to a real method call.
The square brackets were too cute, and I couldn't figure out how to document them anyway!
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 9d3c95dc..93a7bbf6 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -146,41 +146,41 @@ class ConfigTest(CoverageTest):
def test_tweaks_after_constructor(self):
# Arguments to the constructor are applied to the configuration.
cov = coverage.Coverage(timid=True, data_file="fooey.dat")
- cov.config["run:timid"] = False
+ cov.set_option("run:timid", False)
self.assertFalse(cov.config.timid)
self.assertFalse(cov.config.branch)
self.assertEqual(cov.config.data_file, "fooey.dat")
- self.assertFalse(cov.config["run:timid"])
- self.assertFalse(cov.config["run:branch"])
- self.assertEqual(cov.config["run:data_file"], "fooey.dat")
+ self.assertFalse(cov.get_option("run:timid"))
+ self.assertFalse(cov.get_option("run:branch"))
+ self.assertEqual(cov.get_option("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
+ cov.set_option("run:xyzzy", 12)
with self.assertRaises(CoverageException):
- cov.config["xyzzy:foo"] = 12
+ cov.set_option("xyzzy:foo", 12)
with self.assertRaises(CoverageException):
- _ = cov.config["run:xyzzy"]
+ _ = cov.get_option("run:xyzzy")
with self.assertRaises(CoverageException):
- _ = cov.config["xyzzy:foo"]
+ _ = cov.get_option("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"]
+ cov.set_option("run:plugins", ["fooey.plugin", "xyzzy.coverage.plugin"])
+ cov.set_option("fooey.plugin:xyzzy", 17)
+ cov.set_option("xyzzy.coverage.plugin:plugh", ["a", "b"])
with self.assertRaises(CoverageException):
- cov.config["no_such.plugin:foo"] = 23
+ cov.set_option("no_such.plugin:foo", 23)
- self.assertEqual(cov.config["fooey.plugin:xyzzy"], 17)
- self.assertEqual(cov.config["xyzzy.coverage.plugin:plugh"], ["a", "b"])
+ self.assertEqual(cov.get_option("fooey.plugin:xyzzy"), 17)
+ self.assertEqual(cov.get_option("xyzzy.coverage.plugin:plugh"), ["a", "b"])
with self.assertRaises(CoverageException):
- _ = cov.config["no_such.plugin:foo"]
+ _ = cov.get_option("no_such.plugin:foo")
def test_unknown_option(self):
self.make_file(".coveragerc", """\