mirror of
https://github.com/docker/compose.git
synced 2025-07-24 22:24:41 +02:00
Merge pull request #3156 from graingert/fix-type-error-in-exc-handling
Fix TypeError in Exception handling
This commit is contained in:
commit
312d764c9c
@ -66,7 +66,7 @@ def handle_connection_errors(client):
|
|||||||
|
|
||||||
|
|
||||||
def log_api_error(e, client_version):
|
def log_api_error(e, client_version):
|
||||||
if 'client is newer than server' not in e.explanation:
|
if b'client is newer than server' not in e.explanation:
|
||||||
log.error(e.explanation)
|
log.error(e.explanation)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ class TestHandleConnectionErrors(object):
|
|||||||
def test_api_error_version_mismatch(self, mock_logging):
|
def test_api_error_version_mismatch(self, mock_logging):
|
||||||
with pytest.raises(errors.ConnectionError):
|
with pytest.raises(errors.ConnectionError):
|
||||||
with handle_connection_errors(mock.Mock(api_version='1.22')):
|
with handle_connection_errors(mock.Mock(api_version='1.22')):
|
||||||
raise APIError(None, None, "client is newer than server")
|
raise APIError(None, None, b"client is newer than server")
|
||||||
|
|
||||||
_, args, _ = mock_logging.error.mock_calls[0]
|
_, args, _ = mock_logging.error.mock_calls[0]
|
||||||
assert "Docker Engine of version 1.10.0 or greater" in args[0]
|
assert "Docker Engine of version 1.10.0 or greater" in args[0]
|
||||||
|
|
||||||
def test_api_error_version_other(self, mock_logging):
|
def test_api_error_version_other(self, mock_logging):
|
||||||
msg = "Something broke!"
|
msg = b"Something broke!"
|
||||||
with pytest.raises(errors.ConnectionError):
|
with pytest.raises(errors.ConnectionError):
|
||||||
with handle_connection_errors(mock.Mock(api_version='1.22')):
|
with handle_connection_errors(mock.Mock(api_version='1.22')):
|
||||||
raise APIError(None, None, msg)
|
raise APIError(None, None, msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user