diff --git a/compose/__main__.py b/compose/__main__.py index 199ba2ae9..27a7acbb8 100644 --- a/compose/__main__.py +++ b/compose/__main__.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + from compose.cli.main import main main() diff --git a/compose/config/sort_services.py b/compose/config/sort_services.py index 5d9adab11..055521227 100644 --- a/compose/config/sort_services.py +++ b/compose/config/sort_services.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + from compose.config.errors import DependencyError diff --git a/compose/config/validation.py b/compose/config/validation.py index f2162a874..74dd461f3 100644 --- a/compose/config/validation.py +++ b/compose/config/validation.py @@ -254,7 +254,8 @@ def _parse_oneof_validator(error): ) return "{}contains {}, which is an invalid type, it should be {}".format( invalid_config_key, - context.instance, + # Always print the json repr of the invalid value + json.dumps(context.instance), _parse_valid_types_from_validator(context.validator_value)) if context.validator == 'uniqueItems': diff --git a/compose/volume.py b/compose/volume.py index 055bd6abd..fb8bd5809 100644 --- a/compose/volume.py +++ b/compose/volume.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import unicode_literals diff --git a/script/travis/render-bintray-config.py b/script/travis/render-bintray-config.py index c2b11ca3f..b5364a0b6 100755 --- a/script/travis/render-bintray-config.py +++ b/script/travis/render-bintray-config.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import print_function from __future__ import absolute_import +from __future__ import print_function from __future__ import unicode_literals import datetime diff --git a/tests/integration/volume_test.py b/tests/integration/volume_test.py index b60860400..8ae35378a 100644 --- a/tests/integration/volume_test.py +++ b/tests/integration/volume_test.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import unicode_literals from docker.errors import DockerException diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 8cb5d9b26..abb891a27 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -552,7 +552,9 @@ class ConfigTest(unittest.TestCase): ) def test_config_extra_hosts_list_of_dicts_validation_error(self): - expected_error_msg = "key 'extra_hosts' contains {'somehost': '162.242.195.82'}, which is an invalid type, it should be a string" + expected_error_msg = ( + "key 'extra_hosts' contains {\"somehost\": \"162.242.195.82\"}, " + "which is an invalid type, it should be a string") with self.assertRaisesRegexp(ConfigurationError, expected_error_msg): config.load( diff --git a/tests/unit/config/types_test.py b/tests/unit/config/types_test.py index 4df665485..245b854ff 100644 --- a/tests/unit/config/types_test.py +++ b/tests/unit/config/types_test.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import pytest from compose.config.errors import ConfigurationError