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

Fix output of test_lowlevel tests in case of timeout #6136

Merged
merged 1 commit into from Jun 8, 2022

Commits on May 19, 2022

  1. Fix output of test_lowlevel tests in case of timeout

    The tests in test_lowlevel.py use the testserver.server.Server thread
    object.
    
    When using the object as a context manager, we wait until the server
    thread is ready with a timeout.
    
    Unfortunately, if the timeout is reached, we would not propagate the
    error. Instead, we would return from the __enter__ method and access the
    "with" body with an uninitialized value for port (i.e., port = 0).
    
    Therefore, the tests fail with:
    
    E           urllib3.exceptions.NewConnectionError:
    <urllib3.connection.HTTPConnection object at 0x7f068405aec0>: Failed to
    establish a new connection: [Errno 111] Connection refused
    
    Reading this error does not make it obvious that this is the result of a
    timeout.
    
    Fixed by raising an error in case of timeout.
    
    Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
    ogayot committed May 19, 2022
    Copy the full SHA
    22a6422 View commit details
    Browse the repository at this point in the history