Skip to content

Commit d3d366d

Browse files
aiskvstinner
andcommitted
Update test
Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent b19a312 commit d3d366d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎Lib/test/audit-tests.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import sys
1111
import unittest.mock
12-
from test.support import swap_item
12+
from test.support import SHORT_TIMEOUT, swap_item
1313

1414

1515
class TestHook:
@@ -668,11 +668,18 @@ def hook(event, args):
668668
print(event, args)
669669

670670
sys.addaudithook(hook)
671+
671672
hp, ht, _, _ = _winapi.CreateProcess(
672673
sys.executable, command_line, None, None, False, 0, None, None,
673674
subprocess.STARTUPINFO())
674675
_winapi.CloseHandle(ht)
676+
677+
timeout = SHORT_TIMEOUT
678+
timeout = int(timeout * 1000)
679+
result = _winapi.WaitForSingleObject(hp, timeout)
675680
_winapi.CloseHandle(hp)
681+
if result == _winapi.WAIT_TIMEOUT:
682+
raise TimeoutError(f"process still running after {timeout} ms")
676683

677684

678685
def test_assert_unicode():

0 commit comments

Comments
 (0)