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
@@ -1565,10 +1566,20 @@ async def test_main() -> None:
15651566 [sys .executable , "-c" , test_code ],
15661567 text = True ,
15671568 ) as process :
1568- try :
1569- process .wait (2 )
1570- if process .returncode :
1571- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1572- except subprocess .TimeoutExpired as e :
1573- process .kill ()
1574- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1569+ timeout = 10 # seconds
1570+
1571+ start_time = time .monotonic ()
1572+ while True :
1573+ return_code = process .poll ()
1574+ if return_code is not None :
1575+ if return_code != 0 :
1576+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1577+
1578+ # success
1579+ break
1580+
1581+ if time .monotonic () - start_time > timeout :
1582+ process .kill ()
1583+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1584+
1585+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments