summaryrefslogtreecommitdiff
path: root/tests/test_execfile.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_execfile.py
parent4c86353020bea6dfd3f13780501f2083a0bcaeb7 (diff)
downloadpython-coveragepy-git-822953106a01aaf1f88bc5e5a63fe693d42c0c00.tar.gz
Prefer assertRaisesRegex to assertRaises
Diffstat (limited to 'tests/test_execfile.py')
-rw-r--r--tests/test_execfile.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index ced4c28f..340df4cf 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -82,7 +82,7 @@ class RunFileTest(CoverageTest):
self.assertEqual(self.stdout(), "a is 1\n")
def test_no_such_file(self):
- with self.assertRaises(NoSource):
+ with self.assertRaisesRegex(NoSource, "No file to run: 'xyzzy.py'"):
run_python_file(["xyzzy.py"])
def test_directory_with_main(self):
@@ -205,11 +205,11 @@ class RunModuleTest(UsingModulesMixin, CoverageTest):
self.assertEqual(self.stdout(), "pkg1.__init__: pkg1\npkg1.__init__: __main__\n")
def test_no_such_module(self):
- with self.assertRaises(NoSource):
+ with self.assertRaisesRegex(NoSource, "No module named '?i_dont_exist'?"):
run_python_module(["i_dont_exist"])
- with self.assertRaises(NoSource):
+ with self.assertRaisesRegex(NoSource, "No module named '?i'?"):
run_python_module(["i.dont_exist"])
- with self.assertRaises(NoSource):
+ with self.assertRaisesRegex(NoSource, "No module named '?i'?"):
run_python_module(["i.dont.exist"])
def test_no_main(self):