Support python 3

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin 2014-08-19 17:36:46 -04:00
commit 809443d6d0
23 changed files with 128 additions and 85 deletions

View file

@ -1,9 +1,11 @@
from __future__ import print_function
import os
import shutil
import tempfile
from operator import itemgetter
import mock
from .. import mock
from .. import unittest
from compose.config import config
from compose.config.errors import ConfigurationError
@ -30,7 +32,7 @@ class ConfigTest(unittest.TestCase):
)
self.assertEqual(
sorted(service_dicts, key=lambda d: d['name']),
sorted(service_dicts, key=itemgetter('name')),
sorted([
{
'name': 'bar',
@ -41,7 +43,7 @@ class ConfigTest(unittest.TestCase):
'name': 'foo',
'image': 'busybox',
}
], key=lambda d: d['name'])
], key=itemgetter('name'))
)
def test_load_throws_error_when_not_dict(self):
@ -885,24 +887,24 @@ class ExtendsTest(unittest.TestCase):
other_config = {'web': {'links': ['db']}}
with mock.patch.object(config, 'load_yaml', return_value=other_config):
print load_config()
print(load_config())
with self.assertRaisesRegexp(ConfigurationError, 'volumes_from'):
other_config = {'web': {'volumes_from': ['db']}}
with mock.patch.object(config, 'load_yaml', return_value=other_config):
print load_config()
print(load_config())
with self.assertRaisesRegexp(ConfigurationError, 'net'):
other_config = {'web': {'net': 'container:db'}}
with mock.patch.object(config, 'load_yaml', return_value=other_config):
print load_config()
print(load_config())
other_config = {'web': {'net': 'host'}}
with mock.patch.object(config, 'load_yaml', return_value=other_config):
print load_config()
print(load_config())
def test_volume_path(self):
dicts = load_from_filename('tests/fixtures/volume-path/docker-compose.yml')