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
@@ -1869,10 +1870,20 @@ async def test_main() -> None:
1869
1870
[sys .executable , "-c" , test_code ],
1870
1871
text = True ,
1871
1872
) as process :
1872
- try :
1873
- process .wait (2 )
1874
- if process .returncode :
1875
- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1876
- except subprocess .TimeoutExpired as e :
1877
- process .kill ()
1878
- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1873
+ timeout = 10 # seconds
1874
+
1875
+ start_time = time .monotonic ()
1876
+ while True :
1877
+ return_code = process .poll ()
1878
+ if return_code is not None :
1879
+ if return_code != 0 :
1880
+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1881
+
1882
+ # success
1883
+ break
1884
+
1885
+ if time .monotonic () - start_time > timeout :
1886
+ process .kill ()
1887
+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1888
+
1889
+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments