[Python-checkins] cpython: Issue #7732: Move an imp.find_module test from test_import to

brett.cannon python-checkins at python.org
Fri Jun 7 19:27:02 CEST 2013


http://hg.python.org/cpython/rev/bf882390713c
changeset:   84052:bf882390713c
user:        Brett Cannon <brett at python.org>
date:        Fri Jun 07 13:26:53 2013 -0400
summary:
  Issue #7732: Move an imp.find_module test from test_import to
test_imp.

files:
  Lib/test/test_imp.py    |  11 +++++++++++
  Lib/test/test_import.py |  10 ----------
  2 files changed, 11 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -273,6 +273,17 @@
             return
         imp.load_module(name, None, *found[1:])
 
+    @unittest.skipIf(sys.dont_write_bytecode,
+        "test meaningful only when writing bytecode")
+    def test_bug7732(self):
+        source = support.TESTFN + '.py'
+        os.mkdir(source)
+        try:
+            self.assertRaisesRegex(ImportError, '^No module',
+                imp.find_module, support.TESTFN, ["."])
+        finally:
+            os.rmdir(source)
+
 
 class ReloadTests(unittest.TestCase):
 
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
@@ -127,16 +127,6 @@
         finally:
             del sys.path[0]
 
-    @skip_if_dont_write_bytecode
-    def test_bug7732(self):
-        source = TESTFN + '.py'
-        os.mkdir(source)
-        try:
-            self.assertRaisesRegex(ImportError, '^No module',
-                imp.find_module, TESTFN, ["."])
-        finally:
-            os.rmdir(source)
-
     def test_module_with_large_stack(self, module='longlist'):
         # Regression test for http://bugs.python.org/issue561858.
         filename = module + '.py'

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


More information about the Python-checkins mailing list