summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-08-23 18:31:27 (GMT)
committerBrett Cannon <brett@python.org>2013-08-23 18:31:27 (GMT)
commit7e0a18158f8224b68f524fe81896ba64504e0fff (patch)
tree11b0b9e34699c923fac28d6365f4dfc51dd90abe /Lib/test/test_import.py
parenta93c6db68bbb5070398b6cdb029a9bf0365846fc (diff)
downloadcpython-7e0a18158f8224b68f524fe81896ba64504e0fff.zip
cpython-7e0a18158f8224b68f524fe81896ba64504e0fff.tar.gz
cpython-7e0a18158f8224b68f524fe81896ba64504e0fff.tar.bz2
Make test_import more robust and stop using assertRaisesRegexp().
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r--Lib/test/test_import.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 61df86a..11a75a0 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -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