]> granicus.if.org Git - python/commitdiff
Issue #7732: Move an imp.find_module test from test_import to
authorBrett Cannon <brett@python.org>
Fri, 7 Jun 2013 17:26:53 +0000 (13:26 -0400)
committerBrett Cannon <brett@python.org>
Fri, 7 Jun 2013 17:26:53 +0000 (13:26 -0400)
test_imp.

Lib/test/test_imp.py
Lib/test/test_import.py

index 7b85948e94d3b64b190744b611dc4d3ed858dc4f..dc6242325f329099f691eda57a5fc09da8103482 100644 (file)
@@ -273,6 +273,17 @@ class ImportTests(unittest.TestCase):
             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):
 
index 8be66a1893a4ee9cf957a28b8e0dcbc02f835542..9c14e155bc3e54f2d17c2bfdbf1b17048e6ad59e 100644 (file)
@@ -127,16 +127,6 @@ class ImportTests(unittest.TestCase):
         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'