Skip to content

Commit

Permalink
chore(internal): codegen related update (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 22, 2025
1 parent 699cadd commit ff31e82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ testpaths = ["tests"]
addopts = "--tb=short"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
filterwarnings = [
"error"
]
Expand Down
25 changes: 18 additions & 7 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
Expand Down Expand Up @@ -1616,10 +1617,20 @@ async def test_main() -> None:
[sys.executable, "-c", test_code],
text=True,
) as process:
try:
process.wait(2)
if process.returncode:
raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code")
except subprocess.TimeoutExpired as e:
process.kill()
raise AssertionError("calling get_platform using asyncify resulted in a hung process") from e
timeout = 10 # seconds

start_time = time.monotonic()
while True:
return_code = process.poll()
if return_code is not None:
if return_code != 0:
raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code")

# success
break

if time.monotonic() - start_time > timeout:
process.kill()
raise AssertionError("calling get_platform using asyncify resulted in a hung process")

time.sleep(0.1)

0 comments on commit ff31e82

Please sign in to comment.