mirror of https://github.com/docker/compose.git
Merge pull request #1185 from akoskaaa/master
Make test files and config files pep8 valid
This commit is contained in:
commit
367ae0c848
|
@ -8,7 +8,7 @@ set -e
|
|||
script/validate-dco
|
||||
|
||||
>&2 echo "Running lint checks"
|
||||
flake8 compose
|
||||
flake8 compose tests setup.py
|
||||
|
||||
if [ "$DOCKER_VERSIONS" == "" ]; then
|
||||
DOCKER_VERSIONS="1.5.0"
|
||||
|
|
1
setup.py
1
setup.py
|
@ -35,6 +35,7 @@ install_requires = [
|
|||
'six >= 1.3.0, < 2',
|
||||
]
|
||||
|
||||
|
||||
tests_require = [
|
||||
'mock >= 1.0.1',
|
||||
'nose',
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import sys
|
||||
|
||||
if sys.version_info >= (2, 7):
|
||||
import unittest
|
||||
import unittest # NOQA
|
||||
else:
|
||||
import unittest2 as unittest
|
||||
|
||||
import unittest2 as unittest # NOQA
|
||||
|
|
|
@ -182,12 +182,11 @@ class ServiceTest(DockerClientTestCase):
|
|||
entrypoint=['sleep'],
|
||||
command=['300']
|
||||
)
|
||||
old_container = service.create_container()
|
||||
service.create_container()
|
||||
self.assertEqual(len(service.containers(stopped=True)), 1)
|
||||
service.recreate_containers()
|
||||
self.assertEqual(len(service.containers(stopped=True)), 1)
|
||||
|
||||
|
||||
def test_recreate_containers_with_image_declared_volume(self):
|
||||
service = Service(
|
||||
project='composetest',
|
||||
|
@ -229,8 +228,7 @@ class ServiceTest(DockerClientTestCase):
|
|||
set([
|
||||
'composetest_db_1', 'db_1',
|
||||
'composetest_db_2', 'db_2',
|
||||
'db',
|
||||
]),
|
||||
'db'])
|
||||
)
|
||||
|
||||
def test_start_container_creates_links_with_names(self):
|
||||
|
@ -246,8 +244,7 @@ class ServiceTest(DockerClientTestCase):
|
|||
set([
|
||||
'composetest_db_1', 'db_1',
|
||||
'composetest_db_2', 'db_2',
|
||||
'custom_link_name',
|
||||
]),
|
||||
'custom_link_name'])
|
||||
)
|
||||
|
||||
def test_start_container_with_external_links(self):
|
||||
|
@ -265,8 +262,7 @@ class ServiceTest(DockerClientTestCase):
|
|||
set([
|
||||
'composetest_db_1',
|
||||
'composetest_db_2',
|
||||
'db_3',
|
||||
]),
|
||||
'db_3']),
|
||||
)
|
||||
|
||||
def test_start_normal_container_does_not_create_links_to_its_own_service(self):
|
||||
|
@ -291,8 +287,7 @@ class ServiceTest(DockerClientTestCase):
|
|||
set([
|
||||
'composetest_db_1', 'db_1',
|
||||
'composetest_db_2', 'db_2',
|
||||
'db',
|
||||
]),
|
||||
'db'])
|
||||
)
|
||||
|
||||
def test_start_container_builds_images(self):
|
||||
|
|
|
@ -8,7 +8,6 @@ from .. import unittest
|
|||
|
||||
import docker
|
||||
import mock
|
||||
from six import StringIO
|
||||
|
||||
from compose.cli import main
|
||||
from compose.cli.main import TopLevelCommand
|
||||
|
@ -151,4 +150,3 @@ def make_files(dirname, filenames):
|
|||
for fname in filenames:
|
||||
with open(os.path.join(dirname, fname), 'w') as f:
|
||||
f.write('')
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from .. import unittest
|
|||
|
||||
from compose import config
|
||||
|
||||
|
||||
class ConfigTest(unittest.TestCase):
|
||||
def test_from_dictionary(self):
|
||||
service_dicts = config.from_dictionary({
|
||||
|
@ -114,8 +115,7 @@ class EnvTest(unittest.TestCase):
|
|||
os.environ['ENV_DEF'] = 'E3'
|
||||
|
||||
service_dict = config.make_service_dict(
|
||||
'foo',
|
||||
{
|
||||
'foo', {
|
||||
'environment': {
|
||||
'FILE_DEF': 'F1',
|
||||
'FILE_DEF_EMPTY': '',
|
||||
|
@ -174,6 +174,7 @@ class EnvTest(unittest.TestCase):
|
|||
{'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''},
|
||||
)
|
||||
|
||||
|
||||
class ExtendsTest(unittest.TestCase):
|
||||
def test_extends(self):
|
||||
service_dicts = config.load('tests/fixtures/extends/docker-compose.yml')
|
||||
|
@ -231,10 +232,11 @@ class ExtendsTest(unittest.TestCase):
|
|||
],
|
||||
)
|
||||
|
||||
|
||||
def test_extends_validation(self):
|
||||
dictionary = {'extends': None}
|
||||
load_config = lambda: config.make_service_dict('myweb', dictionary, working_dir='tests/fixtures/extends')
|
||||
|
||||
def load_config():
|
||||
return config.make_service_dict('myweb', dictionary, working_dir='tests/fixtures/extends')
|
||||
|
||||
self.assertRaisesRegexp(config.ConfigurationError, 'dictionary', load_config)
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ from compose.container import Container
|
|||
|
||||
class ContainerTest(unittest.TestCase):
|
||||
|
||||
|
||||
def setUp(self):
|
||||
self.container_dict = {
|
||||
"Id": "abc",
|
||||
|
@ -30,7 +29,9 @@ class ContainerTest(unittest.TestCase):
|
|||
container = Container.from_ps(None,
|
||||
self.container_dict,
|
||||
has_been_inspected=True)
|
||||
self.assertEqual(container.dictionary, {
|
||||
self.assertEqual(
|
||||
container.dictionary,
|
||||
{
|
||||
"Id": "abc",
|
||||
"Image": "busybox:latest",
|
||||
"Name": "/composetest_db_1",
|
||||
|
@ -122,10 +123,10 @@ class ContainerTest(unittest.TestCase):
|
|||
container = Container(None, {
|
||||
"Status": "Up 8 seconds",
|
||||
"HostConfig": {
|
||||
"VolumesFrom": ["volume_id",]
|
||||
"VolumesFrom": ["volume_id"]
|
||||
},
|
||||
}, has_been_inspected=True)
|
||||
|
||||
self.assertEqual(container.get('Status'), "Up 8 seconds")
|
||||
self.assertEqual(container.get('HostConfig.VolumesFrom'), ["volume_id",])
|
||||
self.assertEqual(container.get('HostConfig.VolumesFrom'), ["volume_id"])
|
||||
self.assertEqual(container.get('Foo.Bar.DoesNotExist'), None)
|
||||
|
|
|
@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
|||
from __future__ import absolute_import
|
||||
from tests import unittest
|
||||
|
||||
import mock
|
||||
from six import StringIO
|
||||
|
||||
from compose import progress_stream
|
||||
|
|
|
@ -8,6 +8,7 @@ from compose import config
|
|||
import mock
|
||||
import docker
|
||||
|
||||
|
||||
class ProjectTest(unittest.TestCase):
|
||||
def test_from_dict(self):
|
||||
project = Project.from_dicts('composetest', [
|
||||
|
|
|
@ -165,7 +165,8 @@ class ServiceTest(unittest.TestCase):
|
|||
self.assertFalse('domainname' in opts, 'domainname')
|
||||
|
||||
def test_split_domainname_fqdn(self):
|
||||
service = Service('foo',
|
||||
service = Service(
|
||||
'foo',
|
||||
hostname='name.domain.tld',
|
||||
client=self.mock_client)
|
||||
self.mock_client.containers.return_value = []
|
||||
|
@ -174,7 +175,8 @@ class ServiceTest(unittest.TestCase):
|
|||
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
|
||||
|
||||
def test_split_domainname_both(self):
|
||||
service = Service('foo',
|
||||
service = Service(
|
||||
'foo',
|
||||
hostname='name',
|
||||
domainname='domain.tld',
|
||||
client=self.mock_client)
|
||||
|
@ -184,7 +186,8 @@ class ServiceTest(unittest.TestCase):
|
|||
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
|
||||
|
||||
def test_split_domainname_weird(self):
|
||||
service = Service('foo',
|
||||
service = Service(
|
||||
'foo',
|
||||
hostname='name.sub',
|
||||
domainname='domain.tld',
|
||||
client=self.mock_client)
|
||||
|
@ -315,4 +318,3 @@ class ServiceVolumesTest(unittest.TestCase):
|
|||
self.assertEqual(
|
||||
binding,
|
||||
('/home/user', dict(bind='/home/user', ro=False)))
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import absolute_import
|
|||
from compose.cli.utils import split_buffer
|
||||
from .. import unittest
|
||||
|
||||
|
||||
class SplitBufferTest(unittest.TestCase):
|
||||
def test_single_line_chunks(self):
|
||||
def reader():
|
||||
|
|
Loading…
Reference in New Issue