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
@@ -1635,10 +1636,20 @@ async def test_main() -> None:
16351636 [sys .executable , "-c" , test_code ],
16361637 text = True ,
16371638 ) as process :
1638- try :
1639- process .wait (2 )
1640- if process .returncode :
1641- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1642- except subprocess .TimeoutExpired as e :
1643- process .kill ()
1644- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1639+ timeout = 10 # seconds
1640+
1641+ start_time = time .monotonic ()
1642+ while True :
1643+ return_code = process .poll ()
1644+ if return_code is not None :
1645+ if return_code != 0 :
1646+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1647+
1648+ # success
1649+ break
1650+
1651+ if time .monotonic () - start_time > timeout :
1652+ process .kill ()
1653+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1654+
1655+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments