From: Nadeem Vawda Date: Mon, 18 Apr 2011 23:35:58 +0000 (+0200) Subject: Fix sporadic failure in test_startfile. X-Git-Tag: v2.7.2rc1~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bafc6a9fca08922e1d6593f22d989b3a72bdc4f8;p=python Fix sporadic failure in test_startfile. 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. --- diff --git a/Lib/test/test_startfile.py b/Lib/test/test_startfile.py index 8eeae72eab..9dce8fd6ac 100644 --- a/Lib/test/test_startfile.py +++ b/Lib/test/test_startfile.py @@ -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) diff --git a/Misc/NEWS b/Misc/NEWS index ad532abda9..51a0b672de 100644 --- 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.