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 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
@@ -1830,10 +1831,20 @@ async def test_main() -> None:
1830
1831
[sys .executable , "-c" , test_code ],
1831
1832
text = True ,
1832
1833
) as process :
1833
- try :
1834
- process .wait (2 )
1835
- if process .returncode :
1836
- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1837
- except subprocess .TimeoutExpired as e :
1838
- process .kill ()
1839
- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1834
+ timeout = 10 # seconds
1835
+
1836
+ start_time = time .monotonic ()
1837
+ while True :
1838
+ return_code = process .poll ()
1839
+ if return_code is not None :
1840
+ if return_code != 0 :
1841
+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1842
+
1843
+ # success
1844
+ break
1845
+
1846
+ if time .monotonic () - start_time > timeout :
1847
+ process .kill ()
1848
+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1849
+
1850
+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments