Skip to content

Commit 56d0462

Browse files
chore(internal): codegen related update (#141)
1 parent 5580989 commit 56d0462

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ testpaths = ["tests"]
129129
addopts = "--tb=short"
130130
xfail_strict = true
131131
asyncio_mode = "auto"
132+
asyncio_default_fixture_loop_scope = "session"
132133
filterwarnings = [
133134
"error"
134135
]

tests/test_client.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import sys
88
import json
9+
import time
910
import asyncio
1011
import inspect
1112
import 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)

0 commit comments

Comments
 (0)