Skip to content

Commit

Permalink
Fix stacktrace when handling timeout error
Browse files Browse the repository at this point in the history
Signed-off-by: Aanand Prasad <[email protected]>
  • Loading branch information
aanand committed Jul 29, 2016
1 parent dec2c83 commit 5aeeecb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compose/cli/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def handle_connection_errors(client):
log_api_error(e, client.api_version)
raise ConnectionError()
except (ReadTimeout, socket.timeout) as e:
log_timeout_error()
log_timeout_error(client.timeout)
raise ConnectionError()


Expand Down
8 changes: 8 additions & 0 deletions tests/unit/cli/docker_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def test_custom_timeout_error(self):
assert fake_log.error.call_count == 1
assert '123' in fake_log.error.call_args[0][0]

with mock.patch('compose.cli.errors.log') as fake_log:
with pytest.raises(errors.ConnectionError):
with errors.handle_connection_errors(client):
raise errors.ReadTimeout()

assert fake_log.error.call_count == 1
assert '123' in fake_log.error.call_args[0][0]

def test_user_agent(self):
client = docker_client(os.environ)
expected = "docker-compose/{0} docker-py/{1} {2}/{3}".format(
Expand Down

0 comments on commit 5aeeecb

Please sign in to comment.