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
@@ -1711,10 +1712,20 @@ async def test_main() -> None:
1711
1712
[sys .executable , "-c" , test_code ],
1712
1713
text = True ,
1713
1714
) as process :
1714
- try :
1715
- process .wait (2 )
1716
- if process .returncode :
1717
- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1718
- except subprocess .TimeoutExpired as e :
1719
- process .kill ()
1720
- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1715
+ timeout = 10 # seconds
1716
+
1717
+ start_time = time .monotonic ()
1718
+ while True :
1719
+ return_code = process .poll ()
1720
+ if return_code is not None :
1721
+ if return_code != 0 :
1722
+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1723
+
1724
+ # success
1725
+ break
1726
+
1727
+ if time .monotonic () - start_time > timeout :
1728
+ process .kill ()
1729
+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1730
+
1731
+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments