diff --git a/compose/cli/main.py b/compose/cli/main.py index 5121d5c32..deb1e9121 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -42,7 +42,7 @@ from .utils import yesno if not IS_WINDOWS_PLATFORM: - from dockerpty.pty import PseudoTerminal + from dockerpty.pty import PseudoTerminal, RunOperation log = logging.getLogger(__name__) console_handler = logging.StreamHandler(sys.stderr) @@ -712,12 +712,13 @@ def run_one_off_container(container_options, project, service, options): signals.set_signal_handler_to_shutdown() try: try: - pty = PseudoTerminal( + operation = RunOperation( project.client, container.id, interactive=not options['-T'], logs=False, ) + pty = PseudoTerminal(project.client, operation) sockets = pty.sockets() service.start_container(container) pty.start(sockets) diff --git a/requirements.txt b/requirements.txt index 68ef9f351..3fdd34ed0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ PyYAML==3.11 cached-property==1.2.0 -docker-py==1.7.0rc3 +docker-py==1.7.0 +dockerpty==0.4.1 docopt==0.6.1 enum34==1.0.4 -git+https://github.com/d11wtq/dockerpty.git@29b1394108b017ef3e3deaf00604a9eb99880d5e#egg=dockerpty jsonschema==2.5.1 requests==2.7.0 six==1.7.3 diff --git a/setup.py b/setup.py index b365e05be..df4172ce6 100644 --- a/setup.py +++ b/setup.py @@ -34,8 +34,8 @@ install_requires = [ 'requests >= 2.6.1, < 2.8', 'texttable >= 0.8.1, < 0.9', 'websocket-client >= 0.32.0, < 1.0', - 'docker-py >= 1.5.0, < 2', - 'dockerpty >= 0.3.4, < 0.4', + 'docker-py >= 1.7.0, < 2', + 'dockerpty >= 0.4.1, < 0.5', 'six >= 1.3.0, < 2', 'jsonschema >= 2.5.1, < 3', ] diff --git a/tests/unit/cli_test.py b/tests/unit/cli_test.py index fec7cdbae..69236e2e1 100644 --- a/tests/unit/cli_test.py +++ b/tests/unit/cli_test.py @@ -79,8 +79,9 @@ class CLITestCase(unittest.TestCase): TopLevelCommand().dispatch(['help', 'nonexistent'], None) @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason="requires dockerpty") + @mock.patch('compose.cli.main.RunOperation', autospec=True) @mock.patch('compose.cli.main.PseudoTerminal', autospec=True) - def test_run_interactive_passes_logs_false(self, mock_pseudo_terminal): + def test_run_interactive_passes_logs_false(self, mock_pseudo_terminal, mock_run_operation): command = TopLevelCommand() mock_client = mock.create_autospec(docker.Client) mock_project = mock.Mock(client=mock_client) @@ -106,7 +107,7 @@ class CLITestCase(unittest.TestCase): '--name': None, }) - _, _, call_kwargs = mock_pseudo_terminal.mock_calls[0] + _, _, call_kwargs = mock_run_operation.mock_calls[0] assert call_kwargs['logs'] is False @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason="requires dockerpty")