From 78c0734cbd3f553af628a5c19843dbc523cdf28f Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 22 Sep 2015 17:37:14 -0400 Subject: [PATCH] Disable some tests in windows for now. Signed-off-by: Daniel Nephin --- compose/cli/main.py | 6 +++--- compose/const.py | 2 ++ tests/unit/cli_test.py | 3 +++ tests/unit/config/config_test.py | 10 ++++++++++ tests/unit/service_test.py | 3 +++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/compose/cli/main.py b/compose/cli/main.py index bb12b62c2..60e60b795 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -16,6 +16,7 @@ from .. import legacy from ..config import parse_environment from ..const import DEFAULT_TIMEOUT from ..const import HTTP_TIMEOUT +from ..const import IS_WINDOWS_PLATFORM from ..progress_stream import StreamOutputError from ..project import ConfigurationError from ..project import NoSuchService @@ -30,9 +31,8 @@ from .log_printer import LogPrinter from .utils import get_version_info from .utils import yesno -WINDOWS = (sys.platform == 'win32') -if not WINDOWS: +if not IS_WINDOWS_PLATFORM: import dockerpty log = logging.getLogger(__name__) @@ -343,7 +343,7 @@ class TopLevelCommand(Command): detach = options['-d'] - if WINDOWS and not detach: + if IS_WINDOWS_PLATFORM and not detach: raise UserError( "Interactive mode is not yet supported on Windows.\n" "Please pass the -d flag when using `docker-compose run`." diff --git a/compose/const.py b/compose/const.py index dbfa56b8c..b43e655b1 100644 --- a/compose/const.py +++ b/compose/const.py @@ -1,4 +1,5 @@ import os +import sys DEFAULT_TIMEOUT = 10 LABEL_CONTAINER_NUMBER = 'com.docker.compose.container-number' @@ -8,3 +9,4 @@ LABEL_SERVICE = 'com.docker.compose.service' LABEL_VERSION = 'com.docker.compose.version' LABEL_CONFIG_HASH = 'com.docker.compose.config-hash' HTTP_TIMEOUT = int(os.environ.get('COMPOSE_HTTP_TIMEOUT', os.environ.get('DOCKER_CLIENT_TIMEOUT', 60))) +IS_WINDOWS_PLATFORM = (sys.platform == 'win32') diff --git a/tests/unit/cli_test.py b/tests/unit/cli_test.py index 321df97a5..0c78e6bbf 100644 --- a/tests/unit/cli_test.py +++ b/tests/unit/cli_test.py @@ -5,6 +5,7 @@ import os import docker import py +import pytest from .. import mock from .. import unittest @@ -13,6 +14,7 @@ from compose.cli.command import get_project_name from compose.cli.docopt_command import NoSuchCommand from compose.cli.errors import UserError from compose.cli.main import TopLevelCommand +from compose.const import IS_WINDOWS_PLATFORM from compose.service import Service @@ -81,6 +83,7 @@ class CLITestCase(unittest.TestCase): with self.assertRaises(NoSuchCommand): TopLevelCommand().dispatch(['help', 'nonexistent'], None) + @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason="requires dockerpty") @mock.patch('compose.cli.main.dockerpty', autospec=True) def test_run_with_environment_merged_with_options_list(self, mock_dockerpty): command = TopLevelCommand() diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 79864ec78..2dfa764df 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -5,8 +5,11 @@ import shutil import tempfile from operator import itemgetter +import pytest + from compose.config import config from compose.config.errors import ConfigurationError +from compose.const import IS_WINDOWS_PLATFORM from tests import mock from tests import unittest @@ -92,6 +95,7 @@ class ConfigTest(unittest.TestCase): ) ) + @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') def test_load_with_multiple_files(self): base_file = config.ConfigFile( 'base.yaml', @@ -410,6 +414,7 @@ class InterpolationTest(unittest.TestCase): self.assertIn('in service "web"', cm.exception.msg) self.assertIn('"${"', cm.exception.msg) + @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') @mock.patch.dict(os.environ) def test_volume_binding_with_environment_variable(self): os.environ['VOLUME_PATH'] = '/host/path' @@ -422,6 +427,7 @@ class InterpolationTest(unittest.TestCase): )[0] self.assertEqual(d['volumes'], ['/host/path:/container/path']) + @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') @mock.patch.dict(os.environ) def test_volume_binding_with_home(self): os.environ['HOME'] = '/home/user' @@ -817,6 +823,7 @@ class EnvTest(unittest.TestCase): {'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''}, ) + @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') @mock.patch.dict(os.environ) def test_resolve_path(self): os.environ['HOSTENV'] = '/tmp' @@ -1073,6 +1080,7 @@ class ExtendsTest(unittest.TestCase): for service in service_dicts: self.assertTrue(service['hostname'], expected_interpolated_value) + @pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') def test_volume_path(self): dicts = load_from_filename('tests/fixtures/volume-path/docker-compose.yml') @@ -1108,6 +1116,7 @@ class ExtendsTest(unittest.TestCase): self.assertEqual(dicts[0]['environment'], {'FOO': '1'}) +@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') class ExpandPathTest(unittest.TestCase): working_dir = '/home/user/somedir' @@ -1129,6 +1138,7 @@ class ExpandPathTest(unittest.TestCase): self.assertEqual(result, user_path + 'otherdir/somefile') +@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') class BuildPathTest(unittest.TestCase): def setUp(self): self.abs_context_path = os.path.join(os.getcwd(), 'tests/fixtures/build-ctx') diff --git a/tests/unit/service_test.py b/tests/unit/service_test.py index 5f7ae9487..a1c195acf 100644 --- a/tests/unit/service_test.py +++ b/tests/unit/service_test.py @@ -2,9 +2,11 @@ from __future__ import absolute_import from __future__ import unicode_literals import docker +import pytest from .. import mock from .. import unittest +from compose.const import IS_WINDOWS_PLATFORM from compose.const import LABEL_CONFIG_HASH from compose.const import LABEL_ONE_OFF from compose.const import LABEL_PROJECT @@ -439,6 +441,7 @@ def mock_get_image(images): raise NoSuchImageError() +@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash') class ServiceVolumesTest(unittest.TestCase): def setUp(self):