summaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-04-21 18:17:27 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-04-21 18:17:27 -0400
commit822953106a01aaf1f88bc5e5a63fe693d42c0c00 (patch)
treeb5a93ae8239dd6ee18748ef98ca1f46a90245f0d /tests/test_config.py
parent4c86353020bea6dfd3f13780501f2083a0bcaeb7 (diff)
downloadpython-coveragepy-git-822953106a01aaf1f88bc5e5a63fe693d42c0c00.tar.gz
Prefer assertRaisesRegex to assertRaises
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 513522ee..7b019f94 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -214,13 +214,13 @@ class ConfigTest(CoverageTest):
def test_tweak_error_checking(self):
# Trying to set an unknown config value raises an error.
cov = coverage.Coverage()
- with self.assertRaises(CoverageException):
+ with self.assertRaisesRegex(CoverageException, "No such option: 'run:xyzzy'"):
cov.set_option("run:xyzzy", 12)
- with self.assertRaises(CoverageException):
+ with self.assertRaisesRegex(CoverageException, "No such option: 'xyzzy:foo'"):
cov.set_option("xyzzy:foo", 12)
- with self.assertRaises(CoverageException):
+ with self.assertRaisesRegex(CoverageException, "No such option: 'run:xyzzy'"):
_ = cov.get_option("run:xyzzy")
- with self.assertRaises(CoverageException):
+ with self.assertRaisesRegex(CoverageException, "No such option: 'xyzzy:foo'"):
_ = cov.get_option("xyzzy:foo")
def test_tweak_plugin_options(self):
@@ -229,12 +229,12 @@ class ConfigTest(CoverageTest):
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):
+ with self.assertRaisesRegex(CoverageException, "No such option: 'no_such.plugin:foo'"):
cov.set_option("no_such.plugin:foo", 23)
self.assertEqual(cov.get_option("fooey.plugin:xyzzy"), 17)
self.assertEqual(cov.get_option("xyzzy.coverage.plugin:plugh"), ["a", "b"])
- with self.assertRaises(CoverageException):
+ with self.assertRaisesRegex(CoverageException, "No such option: 'no_such.plugin:foo'"):
_ = cov.get_option("no_such.plugin:foo")
def test_unknown_option(self):