[Python-checkins] cpython: Properly cleanup pep3147 modules in test_import

antoine.pitrou python-checkins at python.org
Sat Jun 23 18:13:43 CEST 2012


http://hg.python.org/cpython/rev/1ac6a2f6cbee
changeset:   77633:1ac6a2f6cbee
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sat Jun 23 18:09:55 2012 +0200
summary:
  Properly cleanup pep3147 modules in test_import

files:
  Lib/test/test_import.py |  8 ++++----
  1 files changed, 4 insertions(+), 4 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
@@ -636,6 +636,8 @@
         # Like test___cached__ but for packages.
         def cleanup():
             rmtree('pep3147')
+            unload('pep3147.foo')
+            unload('pep3147')
         os.mkdir('pep3147')
         self.addCleanup(cleanup)
         # Touch the __init__.py
@@ -643,8 +645,6 @@
             pass
         with open(os.path.join('pep3147', 'foo.py'), 'w'):
             pass
-        unload('pep3147.foo')
-        unload('pep3147')
         importlib.invalidate_caches()
         m = __import__('pep3147.foo')
         init_pyc = imp.cache_from_source(
@@ -659,10 +659,10 @@
         # PEP 3147 pyc file.
         def cleanup():
             rmtree('pep3147')
+            unload('pep3147.foo')
+            unload('pep3147')
         os.mkdir('pep3147')
         self.addCleanup(cleanup)
-        unload('pep3147.foo')
-        unload('pep3147')
         # Touch the __init__.py
         with open(os.path.join('pep3147', '__init__.py'), 'w'):
             pass

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


More information about the Python-checkins mailing list