-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
Testing against a running websockets server #1442
Comments
I found a really stupid way to accomplish this by abusing the yield mechanism in pytest-asyncio:
and using it like this:
But I'm sure there must be a better way, right? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry if this is a trivial question, but I've spend a lot of time on it by now.
I wrote a server that does wesocket connection and session management, and I am struggling to find a way to test it properly.
I'm starting the server like this:
"Dispatcher" handles a few things like extracting locale and session ID from the HTTP Request, and then retrieves a session, and attaches it to a Manager object:
Now I want to test the Dispatcher by setting up a server in an async fixture and test it with a few edge cases like reconnect handling etc.
I've been through a couple iterations, currently on this:
When running a test against it, I get [WinError 1225] The remote computer refused the network connection:
Is there something I'm doing wrong (well, probably), is there a best practice to do testing like this?
Do I have to wrap the server into an asyncio task and dispatch it like that?
The text was updated successfully, but these errors were encountered: