File tree 1 file changed +18
-7
lines changed
1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 6
6
import os
7
7
import sys
8
8
import json
9
+ import time
9
10
import asyncio
10
11
import inspect
11
12
import subprocess
@@ -1797,10 +1798,20 @@ async def test_main() -> None:
1797
1798
[sys .executable , "-c" , test_code ],
1798
1799
text = True ,
1799
1800
) as process :
1800
- try :
1801
- process .wait (2 )
1802
- if process .returncode :
1803
- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1804
- except subprocess .TimeoutExpired as e :
1805
- process .kill ()
1806
- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1801
+ timeout = 10 # seconds
1802
+
1803
+ start_time = time .monotonic ()
1804
+ while True :
1805
+ return_code = process .poll ()
1806
+ if return_code is not None :
1807
+ if return_code != 0 :
1808
+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1809
+
1810
+ # success
1811
+ break
1812
+
1813
+ if time .monotonic () - start_time > timeout :
1814
+ process .kill ()
1815
+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1816
+
1817
+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments