]> granicus.if.org Git - python/commitdiff
Issue #7732: try to fix test_bug7732's flakiness on Windows by executing it in a...
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 19 Aug 2013 21:31:18 +0000 (23:31 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 19 Aug 2013 21:31:18 +0000 (23:31 +0200)
Lib/test/test_imp.py

index d3241918b681f6afb581bd3ca36e28e4d1a7920a..8eb56f6c0577fb4d7ca9fd45a984814dd9ecc03c 100644 (file)
@@ -278,13 +278,11 @@ class ImportTests(unittest.TestCase):
     @unittest.skipIf(sys.dont_write_bytecode,
         "test meaningful only when writing bytecode")
     def test_bug7732(self):
-        source = support.TESTFN + '.py'
-        os.mkdir(source)
-        try:
+        with support.temp_cwd():
+            source = support.TESTFN + '.py'
+            os.mkdir(source)
             self.assertRaisesRegex(ImportError, '^No module',
                 imp.find_module, support.TESTFN, ["."])
-        finally:
-            os.rmdir(source)
 
 
 class ReloadTests(unittest.TestCase):