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
@@ -1711,10 +1712,20 @@ async def test_main() -> None:
17111712 [sys .executable , "-c" , test_code ],
17121713 text = True ,
17131714 ) as process :
1714- try :
1715- process .wait (2 )
1716- if process .returncode :
1717- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1718- except subprocess .TimeoutExpired as e :
1719- process .kill ()
1720- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1715+ timeout = 10 # seconds
1716+
1717+ start_time = time .monotonic ()
1718+ while True :
1719+ return_code = process .poll ()
1720+ if return_code is not None :
1721+ if return_code != 0 :
1722+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1723+
1724+ # success
1725+ break
1726+
1727+ if time .monotonic () - start_time > timeout :
1728+ process .kill ()
1729+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1730+
1731+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments