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
@@ -1645,10 +1646,20 @@ async def test_main() -> None:
16451646 [sys .executable , "-c" , test_code ],
16461647 text = True ,
16471648 ) as process :
1648- try :
1649- process .wait (2 )
1650- if process .returncode :
1651- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1652- except subprocess .TimeoutExpired as e :
1653- process .kill ()
1654- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1649+ timeout = 10 # seconds
1650+
1651+ start_time = time .monotonic ()
1652+ while True :
1653+ return_code = process .poll ()
1654+ if return_code is not None :
1655+ if return_code != 0 :
1656+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1657+
1658+ # success
1659+ break
1660+
1661+ if time .monotonic () - start_time > timeout :
1662+ process .kill ()
1663+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1664+
1665+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments