Improve handling of connection errors and error messages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
886328640f
commit
0a091055d2
5 changed files with 153 additions and 113 deletions
|
|
@ -4,28 +4,12 @@ from __future__ import unicode_literals
|
|||
import os
|
||||
|
||||
import pytest
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from compose.cli import errors
|
||||
from compose.cli.command import friendly_error_message
|
||||
from compose.cli.command import get_config_path_from_options
|
||||
from compose.const import IS_WINDOWS_PLATFORM
|
||||
from tests import mock
|
||||
|
||||
|
||||
class TestFriendlyErrorMessage(object):
|
||||
|
||||
def test_dispatch_generic_connection_error(self):
|
||||
with pytest.raises(errors.ConnectionErrorGeneric):
|
||||
with mock.patch(
|
||||
'compose.cli.command.call_silently',
|
||||
autospec=True,
|
||||
side_effect=[0, 1]
|
||||
):
|
||||
with friendly_error_message():
|
||||
raise ConnectionError()
|
||||
|
||||
|
||||
class TestGetConfigPathFromOptions(object):
|
||||
|
||||
def test_path_from_options(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue