-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor reload_openzaak_fixture to use TestContextDecorator
#208
Comments
TestContextDecorator
TestContextDecorator
The reason this is happening is:
# We need to make sure that we are actually providing a
# patched version of the connection class. This might not
# always be the case because the pool keeps previously
# used connections (which might actually be of a different
# class) around. This while loop will terminate because
# eventually the pool will run out of connections.
while not isinstance(connection, connection_class):
connection = get_conn(pool, timeout)
I am not yet sure why. Docker-py makes HTTP connections without increasing the counter for the max number of connections: def _new_conn(self):
return UnixHTTPConnection(
self.base_url, self.socket_path, self.timeout
) While this is the original urllib3 def _new_conn(self) -> BaseHTTPConnection:
"""
Return a fresh :class:`HTTPConnection`.
"""
self.num_connections += 1
... However changing that function to increase the Edit: while not isinstance(connection, connection_class):
connection = get_conn(pool, timeout)
So the loop never ends. |
In conclusion, I think it is not ideal to make this refactor, since the TestContextDecorator runs after that the VCR mocks have been initialised. Even after the fix to the problem with the infinite loop, the mocked VCR responses don't have the right shape that is expected by the docker client. |
Suggested by Victorien. I had tried, but for some reasons the tests started hanging in CI. I didn't have the time to investigate it further.
Decorator: https://github.com/maykinmedia/open-archiefbeheer/blob/feature/165-destroy-cases/backend/src/openarchiefbeheer/utils/utils_decorators.py
Docs: https://github.com/django/django/blob/cf03aa4e94625971852a09e869f7ee7c328b573f/django/test/utils.py#L384
Also fix that in development mode it checks if we are running from cassettes
The text was updated successfully, but these errors were encountered: