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
@@ -1869,10 +1870,20 @@ async def test_main() -> None:
18691870 [sys .executable , "-c" , test_code ],
18701871 text = True ,
18711872 ) as process :
1872- try :
1873- process .wait (2 )
1874- if process .returncode :
1875- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1876- except subprocess .TimeoutExpired as e :
1877- process .kill ()
1878- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1873+ timeout = 10 # seconds
1874+
1875+ start_time = time .monotonic ()
1876+ while True :
1877+ return_code = process .poll ()
1878+ if return_code is not None :
1879+ if return_code != 0 :
1880+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1881+
1882+ # success
1883+ break
1884+
1885+ if time .monotonic () - start_time > timeout :
1886+ process .kill ()
1887+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1888+
1889+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments