]> granicus.if.org Git - python/commitdiff
Fix sporadic failure in test_startfile.
authorNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 18 Apr 2011 23:35:58 +0000 (01:35 +0200)
committerNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 18 Apr 2011 23:35:58 +0000 (01:35 +0200)
Wait for the child process to terminate before ending the test, so that the
regrtest cleanup code doesn't get an error when it tries to delete the
temporary CWD.

Lib/test/test_startfile.py
Misc/NEWS

index 8eeae72eab47dd52113e30d28d707ede11a5b18e..9dce8fd6acbfca6e4b011a1e68ee5f66e30ba851 100644 (file)
@@ -11,6 +11,7 @@ import unittest
 from test import test_support
 import os
 from os import path
+from time import sleep
 
 startfile = test_support.get_attribute(os, 'startfile')
 
@@ -26,11 +27,16 @@ class TestCase(unittest.TestCase):
         empty = path.join(path.dirname(__file__), "empty.vbs")
         startfile(empty)
         startfile(empty, "open")
+        # Give the child process some time to exit before we finish.
+        # Otherwise the cleanup code will not be able to delete the cwd,
+        # because it is still in use.
+        sleep(0.1)
 
     def test_empty_u(self):
         empty = path.join(path.dirname(__file__), "empty.vbs")
         startfile(unicode(empty, "mbcs"))
         startfile(unicode(empty, "mbcs"), "open")
+        sleep(0.1)
 
 def test_main():
     test_support.run_unittest(TestCase)
index ad532abda96d5fd6175b33f0bb717f3f1916f9f9..51a0b672de844c38927afcc85b20a23f989a6a7b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -367,6 +367,8 @@ IDLE
 Tests
 -----
 
+- Fix test_startfile to wait for child process to terminate before finishing.
+
 - Issue #11719: Fix message about unexpected test_msilib skip on non-Windows
   platforms. Patch by Nadeem Vawda.