Commit 4b197a94 authored by Nadeem Vawda's avatar Nadeem Vawda

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.
parent 844d201c
...@@ -11,6 +11,7 @@ import unittest ...@@ -11,6 +11,7 @@ import unittest
from test import test_support from test import test_support
import os import os
from os import path from os import path
from time import sleep
startfile = test_support.get_attribute(os, 'startfile') startfile = test_support.get_attribute(os, 'startfile')
...@@ -26,11 +27,16 @@ class TestCase(unittest.TestCase): ...@@ -26,11 +27,16 @@ class TestCase(unittest.TestCase):
empty = path.join(path.dirname(__file__), "empty.vbs") empty = path.join(path.dirname(__file__), "empty.vbs")
startfile(empty) startfile(empty)
startfile(empty, "open") 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): def test_empty_u(self):
empty = path.join(path.dirname(__file__), "empty.vbs") empty = path.join(path.dirname(__file__), "empty.vbs")
startfile(unicode(empty, "mbcs")) startfile(unicode(empty, "mbcs"))
startfile(unicode(empty, "mbcs"), "open") startfile(unicode(empty, "mbcs"), "open")
sleep(0.1)
def test_main(): def test_main():
test_support.run_unittest(TestCase) test_support.run_unittest(TestCase)
......
...@@ -367,6 +367,8 @@ IDLE ...@@ -367,6 +367,8 @@ IDLE
Tests 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 - Issue #11719: Fix message about unexpected test_msilib skip on non-Windows
platforms. Patch by Nadeem Vawda. platforms. Patch by Nadeem Vawda.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment