Merge pull request from aanand/fix-timeout-error

Fix stacktrace when handling timeout error
This commit is contained in:
Joffrey F 2016-07-29 14:09:21 -07:00 committed by GitHub
commit 6ce066274e
2 changed files with 9 additions and 1 deletions
compose/cli
tests/unit/cli

View File

@ -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()

View File

@ -42,6 +42,14 @@ class DockerClientTestCase(unittest.TestCase):
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(