[Python-checkins] cpython: Make test_import more robust and stop using assertRaisesRegexp().

brett.cannon python-checkins at python.org
Fri Aug 23 21:15:58 CEST 2013


http://hg.python.org/cpython/rev/0bceedc05583
changeset:   85346:0bceedc05583
parent:      85343:01f33959ddf6
user:        Brett Cannon <brett at python.org>
date:        Fri Aug 23 14:31:27 2013 -0400
summary:
  Make test_import more robust and stop using assertRaisesRegexp().

files:
  Lib/test/test_import.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -322,11 +322,11 @@
         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 @@
         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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list