Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 58de6ee

Browse files
committed
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.
1 parent 6c9b35b commit 58de6ee

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_startfile.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from test import support
1212
import os
1313
from os import path
14+
from time import sleep
1415

1516
startfile = support.get_attribute(os, 'startfile')
1617

@@ -23,6 +24,10 @@ def test_empty(self):
2324
empty = path.join(path.dirname(__file__), "empty.vbs")
2425
startfile(empty)
2526
startfile(empty, "open")
27+
# Give the child process some time to exit before we finish.
28+
# Otherwise the cleanup code will not be able to delete the cwd,
29+
# because it is still in use.
30+
sleep(0.1)
2631

2732
def test_main():
2833
support.run_unittest(TestCase)

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ Build
315315
Tests
316316
-----
317317

318+
- Fix test_startfile to wait for child process to terminate before finishing.
319+
318320
- Issue #11719: Fix message about unexpected test_msilib skip on non-Windows
319321
platforms. Patch by Nadeem Vawda.
320322

0 commit comments

Comments
 (0)