File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 66import os
77import sys
88import json
9+ import time
910import asyncio
1011import inspect
1112import subprocess
@@ -1797,10 +1798,20 @@ async def test_main() -> None:
17971798 [sys .executable , "-c" , test_code ],
17981799 text = True ,
17991800 ) as process :
1800- try :
1801- process .wait (2 )
1802- if process .returncode :
1803- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1804- except subprocess .TimeoutExpired as e :
1805- process .kill ()
1806- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1801+ timeout = 10 # seconds
1802+
1803+ start_time = time .monotonic ()
1804+ while True :
1805+ return_code = process .poll ()
1806+ if return_code is not None :
1807+ if return_code != 0 :
1808+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1809+
1810+ # success
1811+ break
1812+
1813+ if time .monotonic () - start_time > timeout :
1814+ process .kill ()
1815+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1816+
1817+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments