]> granicus.if.org Git - python/commitdiff
Make test_import more robust and stop using assertRaisesRegexp().
authorBrett Cannon <brett@python.org>
Fri, 23 Aug 2013 18:31:27 +0000 (14:31 -0400)
committerBrett Cannon <brett@python.org>
Fri, 23 Aug 2013 18:31:27 +0000 (14:31 -0400)
Lib/test/test_import.py

index 61df86a841ba84a69f72b32448adfe0b18f8861f..11a75a07644c169ed21ab248edfec5b995cc4f21 100644 (file)
@@ -322,11 +322,11 @@ class ImportTests(unittest.TestCase):
         self.assertIn(b"ImportError", stdout)
 
     def test_from_import_message_for_nonexistent_module(self):
-        with self.assertRaisesRegexp(ImportError, "^No module named 'bogus'"):
+        with self.assertRaisesRegex(ImportError, "^No module named 'bogus'"):
             from bogus import foo
 
     def test_from_import_message_for_existing_module(self):
-        with self.assertRaisesRegexp(ImportError, "^cannot import name 'bogus'"):
+        with self.assertRaisesRegex(ImportError, "^cannot import name 'bogus'"):
             from re import bogus
 
 
@@ -689,6 +689,7 @@ class PycacheTests(unittest.TestCase):
         self.assertTrue(os.path.exists(pyc_file))
         os.remove(self.source)
         forget(TESTFN)
+        importlib.invalidate_caches()
         self.assertRaises(ImportError, __import__, TESTFN)
 
     @skip_if_dont_write_bytecode