[Python-checkins] cpython: Issue #7732: try to fix test_bug7732's flakiness on Windows by executing it in

antoine.pitrou python-checkins at python.org
Mon Aug 19 23:31:31 CEST 2013


http://hg.python.org/cpython/rev/4f7845be9e23
changeset:   85277:4f7845be9e23
parent:      85275:f4271cc2dfb5
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Mon Aug 19 23:31:18 2013 +0200
summary:
  Issue #7732: try to fix test_bug7732's flakiness on Windows by executing it in a fresh temporary directory.

files:
  Lib/test/test_imp.py |  8 +++-----
  1 files changed, 3 insertions(+), 5 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
@@ -278,13 +278,11 @@
     @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):

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


More information about the Python-checkins mailing list