-
-
Notifications
You must be signed in to change notification settings - Fork 754
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
Wait for client on test_connection_lost_before_handshake_complete
#2001
Conversation
This comment was marked as spam.
This comment was marked as spam.
tests/protocols/test_websocket.py
Outdated
task = asyncio.create_task( | ||
websocket_session(f"ws://127.0.0.1:{unused_tcp_port}") | ||
) | ||
asyncio.create_task(websocket_session(f"ws://127.0.0.1:{unused_tcp_port}")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the task =
is important please keep it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important when you don't want the GC to clean it, since it's a weak ref, but in this case since all the logic happens in the same function scope, I don't think I need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's been a while so I dont remember exactly but when I reworked the whole test suite and added strict settings to pytest this helped a lot.
The test is hanging. I'm investigating. |
The test is hanging at |
It looks like the success rate increases with a print 🤣 |
@@ -749,12 +749,13 @@ async def websocket_session(uri): | |||
) | |||
await asyncio.sleep(0.1) | |||
send_accept_task.set() | |||
await asyncio.sleep(0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this tick was needed 😄
I've run the same commit 8x, and it passed on all of them. Should be fine now (...or I'm lucky). 👍 |
This PR solves the flakyness on
test_connection_lost_before_handshake_complete
.