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
@@ -1739,10 +1740,20 @@ async def test_main() -> None:
17391740 [sys .executable , "-c" , test_code ],
17401741 text = True ,
17411742 ) as process :
1742- try :
1743- process .wait (2 )
1744- if process .returncode :
1745- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1746- except subprocess .TimeoutExpired as e :
1747- process .kill ()
1748- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1743+ timeout = 10 # seconds
1744+
1745+ start_time = time .monotonic ()
1746+ while True :
1747+ return_code = process .poll ()
1748+ if return_code is not None :
1749+ if return_code != 0 :
1750+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1751+
1752+ # success
1753+ break
1754+
1755+ if time .monotonic () - start_time > timeout :
1756+ process .kill ()
1757+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1758+
1759+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments