summaryrefslogtreecommitdiff
path: root/tests/test_plugins.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_plugins.py
parent4c86353020bea6dfd3f13780501f2083a0bcaeb7 (diff)
downloadpython-coveragepy-git-822953106a01aaf1f88bc5e5a63fe693d42c0c00.tar.gz
Prefer assertRaisesRegex to assertRaises
Diffstat (limited to 'tests/test_plugins.py')
-rw-r--r--tests/test_plugins.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 21653a61..f5a17619 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -121,7 +121,7 @@ class LoadPluginsTest(CoverageTest):
self.assertEqual(plugins[1].options, {'a': 'second'})
def test_cant_import(self):
- with self.assertRaises(ImportError):
+ with self.assertRaisesRegex(ImportError, "No module named '?plugin_not_there'?"):
_ = Plugins.load_plugins(["plugin_not_there"], None)
def test_plugin_must_define_coverage_init(self):
@@ -160,7 +160,7 @@ class PluginTest(CoverageTest):
def test_missing_plugin_raises_import_error(self):
# Prove that a missing plugin will raise an ImportError.
- with self.assertRaises(ImportError):
+ with self.assertRaisesRegex(ImportError, "No module named '?does_not_exist_woijwoicweo'?"):
cov = coverage.Coverage()
cov.set_option("run:plugins", ["does_not_exist_woijwoicweo"])
cov.start()
@@ -1137,7 +1137,8 @@ class DynamicContextPluginOtherTracersTest(CoverageTest):
cov = coverage.Coverage()
cov.set_option("run:plugins", ['context_plugin'])
- with self.assertRaises(CoverageException):
+ msg = "Can't support dynamic contexts with PyTracer"
+ with self.assertRaisesRegex(CoverageException, msg):
cov.start()
cov.stop() # pragma: nested