mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
support PyYAML up to 5.x version
Signed-off-by: Sergey Fursov <geyser85@gmail.com>
This commit is contained in:
parent
33eeef41ab
commit
c818bfc62c
@ -17,7 +17,7 @@ paramiko==2.6.0
|
||||
pypiwin32==219; sys_platform == 'win32' and python_version < '3.6'
|
||||
pypiwin32==223; sys_platform == 'win32' and python_version >= '3.6'
|
||||
PySocks==1.7.1
|
||||
PyYAML==4.2b1
|
||||
PyYAML==5.3
|
||||
requests==2.22.0
|
||||
six==1.12.0
|
||||
subprocess32==3.5.4; python_version < '3.2'
|
||||
|
2
setup.py
2
setup.py
@ -32,7 +32,7 @@ def find_version(*file_paths):
|
||||
install_requires = [
|
||||
'cached-property >= 1.2.0, < 2',
|
||||
'docopt >= 0.6.1, < 1',
|
||||
'PyYAML >= 3.10, < 5',
|
||||
'PyYAML >= 3.10, < 6',
|
||||
'requests >= 2.20.0, < 3',
|
||||
'texttable >= 0.9.0, < 2',
|
||||
'websocket-client >= 0.32.0, < 1',
|
||||
|
@ -269,7 +269,7 @@ services:
|
||||
# assert there are no python objects encoded in the output
|
||||
assert '!!' not in result.stdout
|
||||
|
||||
output = yaml.load(result.stdout)
|
||||
output = yaml.safe_load(result.stdout)
|
||||
expected = {
|
||||
'version': '2.0',
|
||||
'volumes': {'data': {'driver': 'local'}},
|
||||
@ -294,7 +294,7 @@ services:
|
||||
def test_config_restart(self):
|
||||
self.base_dir = 'tests/fixtures/restart'
|
||||
result = self.dispatch(['config'])
|
||||
assert yaml.load(result.stdout) == {
|
||||
assert yaml.safe_load(result.stdout) == {
|
||||
'version': '2.0',
|
||||
'services': {
|
||||
'never': {
|
||||
@ -323,7 +323,7 @@ services:
|
||||
def test_config_external_network(self):
|
||||
self.base_dir = 'tests/fixtures/networks'
|
||||
result = self.dispatch(['-f', 'external-networks.yml', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert 'networks' in json_result
|
||||
assert json_result['networks'] == {
|
||||
'networks_foo': {
|
||||
@ -337,7 +337,7 @@ services:
|
||||
def test_config_with_dot_env(self):
|
||||
self.base_dir = 'tests/fixtures/default-env-file'
|
||||
result = self.dispatch(['config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert json_result == {
|
||||
'services': {
|
||||
'web': {
|
||||
@ -352,7 +352,7 @@ services:
|
||||
def test_config_with_env_file(self):
|
||||
self.base_dir = 'tests/fixtures/default-env-file'
|
||||
result = self.dispatch(['--env-file', '.env2', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert json_result == {
|
||||
'services': {
|
||||
'web': {
|
||||
@ -367,7 +367,7 @@ services:
|
||||
def test_config_with_dot_env_and_override_dir(self):
|
||||
self.base_dir = 'tests/fixtures/default-env-file'
|
||||
result = self.dispatch(['--project-directory', 'alt/', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert json_result == {
|
||||
'services': {
|
||||
'web': {
|
||||
@ -382,7 +382,7 @@ services:
|
||||
def test_config_external_volume_v2(self):
|
||||
self.base_dir = 'tests/fixtures/volumes'
|
||||
result = self.dispatch(['-f', 'external-volumes-v2.yml', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert 'volumes' in json_result
|
||||
assert json_result['volumes'] == {
|
||||
'foo': {
|
||||
@ -398,7 +398,7 @@ services:
|
||||
def test_config_external_volume_v2_x(self):
|
||||
self.base_dir = 'tests/fixtures/volumes'
|
||||
result = self.dispatch(['-f', 'external-volumes-v2-x.yml', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert 'volumes' in json_result
|
||||
assert json_result['volumes'] == {
|
||||
'foo': {
|
||||
@ -414,7 +414,7 @@ services:
|
||||
def test_config_external_volume_v3_x(self):
|
||||
self.base_dir = 'tests/fixtures/volumes'
|
||||
result = self.dispatch(['-f', 'external-volumes-v3-x.yml', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert 'volumes' in json_result
|
||||
assert json_result['volumes'] == {
|
||||
'foo': {
|
||||
@ -430,7 +430,7 @@ services:
|
||||
def test_config_external_volume_v3_4(self):
|
||||
self.base_dir = 'tests/fixtures/volumes'
|
||||
result = self.dispatch(['-f', 'external-volumes-v3-4.yml', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert 'volumes' in json_result
|
||||
assert json_result['volumes'] == {
|
||||
'foo': {
|
||||
@ -446,7 +446,7 @@ services:
|
||||
def test_config_external_network_v3_5(self):
|
||||
self.base_dir = 'tests/fixtures/networks'
|
||||
result = self.dispatch(['-f', 'external-networks-v3-5.yml', 'config'])
|
||||
json_result = yaml.load(result.stdout)
|
||||
json_result = yaml.safe_load(result.stdout)
|
||||
assert 'networks' in json_result
|
||||
assert json_result['networks'] == {
|
||||
'foo': {
|
||||
@ -462,7 +462,7 @@ services:
|
||||
def test_config_v1(self):
|
||||
self.base_dir = 'tests/fixtures/v1-config'
|
||||
result = self.dispatch(['config'])
|
||||
assert yaml.load(result.stdout) == {
|
||||
assert yaml.safe_load(result.stdout) == {
|
||||
'version': '2.1',
|
||||
'services': {
|
||||
'net': {
|
||||
@ -487,7 +487,7 @@ services:
|
||||
self.base_dir = 'tests/fixtures/v3-full'
|
||||
result = self.dispatch(['config'])
|
||||
|
||||
assert yaml.load(result.stdout) == {
|
||||
assert yaml.safe_load(result.stdout) == {
|
||||
'version': '3.5',
|
||||
'volumes': {
|
||||
'foobar': {
|
||||
@ -564,7 +564,7 @@ services:
|
||||
self.base_dir = 'tests/fixtures/compatibility-mode'
|
||||
result = self.dispatch(['--compatibility', 'config'])
|
||||
|
||||
assert yaml.load(result.stdout) == {
|
||||
assert yaml.safe_load(result.stdout) == {
|
||||
'version': '2.3',
|
||||
'volumes': {'foo': {'driver': 'default'}},
|
||||
'networks': {'bar': {}},
|
||||
|
@ -5060,7 +5060,7 @@ class HealthcheckTest(unittest.TestCase):
|
||||
})
|
||||
)
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
serialized_service = serialized_config['services']['test']
|
||||
|
||||
assert serialized_service['healthcheck'] == {
|
||||
@ -5087,7 +5087,7 @@ class HealthcheckTest(unittest.TestCase):
|
||||
})
|
||||
)
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
serialized_service = serialized_config['services']['test']
|
||||
|
||||
assert serialized_service['healthcheck'] == {
|
||||
@ -5294,7 +5294,7 @@ class SerializeTest(unittest.TestCase):
|
||||
'secrets': secrets_dict
|
||||
}))
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
serialized_service = serialized_config['services']['web']
|
||||
assert secret_sort(serialized_service['secrets']) == secret_sort(service_dict['secrets'])
|
||||
assert 'secrets' in serialized_config
|
||||
@ -5309,7 +5309,7 @@ class SerializeTest(unittest.TestCase):
|
||||
}
|
||||
], volumes={}, networks={}, secrets={}, configs={})
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
assert '8080:80/tcp' in serialized_config['services']['web']['ports']
|
||||
|
||||
def test_serialize_ports_with_ext_ip(self):
|
||||
@ -5321,7 +5321,7 @@ class SerializeTest(unittest.TestCase):
|
||||
}
|
||||
], volumes={}, networks={}, secrets={}, configs={})
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
assert '127.0.0.1:8080:80/tcp' in serialized_config['services']['web']['ports']
|
||||
|
||||
def test_serialize_configs(self):
|
||||
@ -5349,7 +5349,7 @@ class SerializeTest(unittest.TestCase):
|
||||
'configs': configs_dict
|
||||
}))
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
serialized_service = serialized_config['services']['web']
|
||||
assert secret_sort(serialized_service['configs']) == secret_sort(service_dict['configs'])
|
||||
assert 'configs' in serialized_config
|
||||
@ -5389,7 +5389,7 @@ class SerializeTest(unittest.TestCase):
|
||||
}
|
||||
config_dict = config.load(build_config_details(cfg))
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
serialized_service = serialized_config['services']['web']
|
||||
assert serialized_service['environment']['CURRENCY'] == '$$'
|
||||
assert serialized_service['command'] == 'echo $$FOO'
|
||||
@ -5411,7 +5411,7 @@ class SerializeTest(unittest.TestCase):
|
||||
}
|
||||
config_dict = config.load(build_config_details(cfg), interpolate=False)
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict, escape_dollar=False))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict, escape_dollar=False))
|
||||
serialized_service = serialized_config['services']['web']
|
||||
assert serialized_service['environment']['CURRENCY'] == '$'
|
||||
assert serialized_service['command'] == 'echo $FOO'
|
||||
@ -5430,7 +5430,7 @@ class SerializeTest(unittest.TestCase):
|
||||
|
||||
config_dict = config.load(build_config_details(cfg))
|
||||
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
serialized_service = serialized_config['services']['web']
|
||||
assert serialized_service['command'] == 'echo 十六夜 咲夜'
|
||||
|
||||
@ -5446,6 +5446,6 @@ class SerializeTest(unittest.TestCase):
|
||||
}
|
||||
|
||||
config_dict = config.load(build_config_details(cfg))
|
||||
serialized_config = yaml.load(serialize_config(config_dict))
|
||||
serialized_config = yaml.safe_load(serialize_config(config_dict))
|
||||
serialized_volume = serialized_config['volumes']['test']
|
||||
assert serialized_volume['external'] is False
|
||||
|
Loading…
x
Reference in New Issue
Block a user