summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_config.py13
-rw-r--r--tests/test_plugins.py12
2 files changed, 21 insertions, 4 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 4c8735d2..109a2fbc 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -123,6 +123,19 @@ class ConfigTest(CoverageTest):
["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
)
+ def test_tweaks_after_constructor(self):
+ # Arguments to the constructor are applied to the configuation.
+ cov = coverage.coverage(timid=True, data_file="fooey.dat")
+ cov.config["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")
+
class ConfigFileTest(CoverageTest):
"""Tests of the config file settings in particular."""
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 1bd2067d..1540c500 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -101,7 +101,8 @@ class PluginTest(CoverageTest):
""")
self.assert_doesnt_exist("evidence.out")
- cov = coverage.Coverage(plugins=["my_plugin"])
+ cov = coverage.Coverage()
+ cov.config["run:plugins"] = ["my_plugin"]
cov.start()
cov.stop()
@@ -111,7 +112,8 @@ class PluginTest(CoverageTest):
def test_missing_plugin_raises_import_error(self):
# Prove that a missing plugin will raise an ImportError.
with self.assertRaises(ImportError):
- cov = coverage.Coverage(plugins=["does_not_exist_woijwoicweo"])
+ cov = coverage.Coverage()
+ cov.config["run:plugins"] = ["does_not_exist_woijwoicweo"]
cov.start()
cov.stop()
@@ -121,7 +123,8 @@ class PluginTest(CoverageTest):
1/0
""")
with self.assertRaises(ZeroDivisionError):
- cov = coverage.Coverage(plugins=["plugin_over_zero"])
+ cov = coverage.Coverage()
+ cov.config["run:plugins"] = ["plugin_over_zero"]
cov.start()
cov.stop()
@@ -139,7 +142,8 @@ class PluginTest(CoverageTest):
d = 4
""")
- cov = coverage.Coverage(plugins=["tests.test_plugins"])
+ cov = coverage.Coverage()
+ cov.config["run:plugins"] = ["tests.test_plugins"]
# Import the python file, executing it.
self.start_import_stop(cov, "simple")