]> granicus.if.org Git - python/commitdiff
Fix sporadic failure in test_startfile.
authorNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 18 Apr 2011 23:38:47 +0000 (01:38 +0200)
committerNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 18 Apr 2011 23:38:47 +0000 (01:38 +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 7a003eb54b692569c9c4f0636e5538e569614989..dd505bf8cedc13bdfacbfc0e8c4906093a7a4cb7 100644 (file)
@@ -11,6 +11,7 @@ import unittest
 from test import support
 import os
 from os import path
+from time import sleep
 
 startfile = support.get_attribute(os, 'startfile')
 
@@ -23,6 +24,10 @@ 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_main():
     support.run_unittest(TestCase)
index 022ad202e40207d6c2f57766166bd83f2dd9487a..8063d02ad1b3058b2ff71ce6e0f91a5794552e01 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -315,6 +315,8 @@ Build
 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.