File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ testpaths = ["tests"]
129129addopts = " --tb=short"
130130xfail_strict = true
131131asyncio_mode = " auto"
132+ asyncio_default_fixture_loop_scope = " session"
132133filterwarnings = [
133134 " error"
134135]
Original file line number Diff line number Diff line change 66import os
77import sys
88import json
9+ import time
910import asyncio
1011import inspect
1112import subprocess
@@ -1609,10 +1610,20 @@ async def test_main() -> None:
16091610 [sys .executable , "-c" , test_code ],
16101611 text = True ,
16111612 ) as process :
1612- try :
1613- process .wait (2 )
1614- if process .returncode :
1615- raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1616- except subprocess .TimeoutExpired as e :
1617- process .kill ()
1618- raise AssertionError ("calling get_platform using asyncify resulted in a hung process" ) from e
1613+ timeout = 10 # seconds
1614+
1615+ start_time = time .monotonic ()
1616+ while True :
1617+ return_code = process .poll ()
1618+ if return_code is not None :
1619+ if return_code != 0 :
1620+ raise AssertionError ("calling get_platform using asyncify resulted in a non-zero exit code" )
1621+
1622+ # success
1623+ break
1624+
1625+ if time .monotonic () - start_time > timeout :
1626+ process .kill ()
1627+ raise AssertionError ("calling get_platform using asyncify resulted in a hung process" )
1628+
1629+ time .sleep (0.1 )
You can’t perform that action at this time.
0 commit comments