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
@@ -1539,10 +1540,20 @@ async def test_main() -> None:
1539
1540
[sys .executable , "-c" , test_code ],
1540
1541
text = True ,
1541
1542
) as process :
1542
- try :
1543
- process .wait (2 )
1544
- if process .returncode :
1545
- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1546
- except subprocess .TimeoutExpired as e :
1547
- process .kill ()
1548
- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1543
+ timeout = 10 # seconds
1544
+
1545
+ start_time = time .monotonic ()
1546
+ while True :
1547
+ return_code = process .poll ()
1548
+ if return_code is not None :
1549
+ if return_code != 0 :
1550
+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1551
+
1552
+ # success
1553
+ break
1554
+
1555
+ if time .monotonic () - start_time > timeout :
1556
+ process .kill ()
1557
+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1558
+
1559
+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments