1. Nick Coghlan
  2. cpython_sandbox

Commits

Brett Cannon  committed 0bceedc

Make test_import more robust and stop using assertRaisesRegexp().

  • Participants
  • Parent commits 01f3395
  • Branches default

Comments (0)

Files changed (1)

File Lib/test/test_import.py

View file
         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
 
 
         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