-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Making tests with AioHTTPTestCase #2032
Comments
I believe the whole confusion come from the flexible parameter If you use an Application instance, then In my opinion the type of |
Fixed by #2074 |
Long story short
I'm trying to make my test to run on the same port instead of a random port. The reason is that I'm making integration tests and I need it to receive calls from another service that I can't really configure the port easily.
My idea is that I need to make a class FixedPortTestServer that will inherit from TestServer and override the
start_server
method to force a specific port.Then I need to pass this instance to the TestClient initialization. The AioHTTPTestCase use the result of
get_application
and give it to TestClient init parameters. This makes me think that I can makeget_application
return the FixedPortTestServer instance instead of the application instance:Which is wrong... Now I have a properly initialized TestClient using my TestServer but
self.app
in the AioHTTPTestCase give me the TestServer instead of my application which doesn't make any sense.Expected behaviour
I expect to get the application from
self.app
within a test method of AioHTTPTestCase and I want to be able to override the TestServer instance with whatever BaseTestServer instance I want without needing to override a private method.Actual behaviour
Currently, my only way to override the TestServer instance in the initialization of the TestClient is to override the private method
_get_client
in the AioHTTPTestCase.Steps to reproduce
Your environment
Python 3.6
The text was updated successfully, but these errors were encountered: