Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve reliability of run_app test #8309

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tests/test_run_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,10 +931,16 @@ async def stop(self, request: web.Request) -> web.Response:

def run_app(self, port: int, timeout: int, task, extra_test=None) -> asyncio.Task:
async def test() -> None:
await asyncio.sleep(1)
await asyncio.sleep(0.5)
async with ClientSession() as sess:
async with sess.get(f"http://localhost:{port}/"):
pass
for _ in range(5): # pragma: no cover
try:
async with sess.get(f"http://localhost:{port}/"):
pass
except ClientConnectorError:
await asyncio.sleep(0.5)
else:
break
async with sess.get(f"http://localhost:{port}/stop"):
pass

Expand Down
Loading