mirror of https://github.com/docker/docs.git
[pep8] make test files and config files pep8 valid
Signed-off-by: akoskaaa <akos.hochrein@prezi.com>
This commit is contained in:
parent
9aab7bc242
commit
f9ea5ecf40
1
setup.py
1
setup.py
|
@ -35,6 +35,7 @@ install_requires = [
|
||||||
'six >= 1.3.0, < 2',
|
'six >= 1.3.0, < 2',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
tests_require = [
|
tests_require = [
|
||||||
'mock >= 1.0.1',
|
'mock >= 1.0.1',
|
||||||
'nose',
|
'nose',
|
||||||
|
|
|
@ -4,4 +4,3 @@ if sys.version_info >= (2,7):
|
||||||
import unittest
|
import unittest
|
||||||
else:
|
else:
|
||||||
import unittest2 as unittest
|
import unittest2 as unittest
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,6 @@ class ServiceTest(DockerClientTestCase):
|
||||||
service.recreate_containers()
|
service.recreate_containers()
|
||||||
self.assertEqual(len(service.containers(stopped=True)), 1)
|
self.assertEqual(len(service.containers(stopped=True)), 1)
|
||||||
|
|
||||||
|
|
||||||
def test_recreate_containers_with_image_declared_volume(self):
|
def test_recreate_containers_with_image_declared_volume(self):
|
||||||
service = Service(
|
service = Service(
|
||||||
project='composetest',
|
project='composetest',
|
||||||
|
@ -229,8 +228,7 @@ class ServiceTest(DockerClientTestCase):
|
||||||
set([
|
set([
|
||||||
'composetest_db_1', 'db_1',
|
'composetest_db_1', 'db_1',
|
||||||
'composetest_db_2', 'db_2',
|
'composetest_db_2', 'db_2',
|
||||||
'db',
|
'db'])
|
||||||
]),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_start_container_creates_links_with_names(self):
|
def test_start_container_creates_links_with_names(self):
|
||||||
|
@ -246,8 +244,7 @@ class ServiceTest(DockerClientTestCase):
|
||||||
set([
|
set([
|
||||||
'composetest_db_1', 'db_1',
|
'composetest_db_1', 'db_1',
|
||||||
'composetest_db_2', 'db_2',
|
'composetest_db_2', 'db_2',
|
||||||
'custom_link_name',
|
'custom_link_name'])
|
||||||
]),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_start_container_with_external_links(self):
|
def test_start_container_with_external_links(self):
|
||||||
|
@ -291,8 +288,7 @@ class ServiceTest(DockerClientTestCase):
|
||||||
set([
|
set([
|
||||||
'composetest_db_1', 'db_1',
|
'composetest_db_1', 'db_1',
|
||||||
'composetest_db_2', 'db_2',
|
'composetest_db_2', 'db_2',
|
||||||
'db',
|
'db'])
|
||||||
]),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_start_container_builds_images(self):
|
def test_start_container_builds_images(self):
|
||||||
|
|
|
@ -151,4 +151,3 @@ def make_files(dirname, filenames):
|
||||||
for fname in filenames:
|
for fname in filenames:
|
||||||
with open(os.path.join(dirname, fname), 'w') as f:
|
with open(os.path.join(dirname, fname), 'w') as f:
|
||||||
f.write('')
|
f.write('')
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from .. import unittest
|
||||||
|
|
||||||
from compose import config
|
from compose import config
|
||||||
|
|
||||||
|
|
||||||
class ConfigTest(unittest.TestCase):
|
class ConfigTest(unittest.TestCase):
|
||||||
def test_from_dictionary(self):
|
def test_from_dictionary(self):
|
||||||
service_dicts = config.from_dictionary({
|
service_dicts = config.from_dictionary({
|
||||||
|
@ -114,8 +115,7 @@ class EnvTest(unittest.TestCase):
|
||||||
os.environ['ENV_DEF'] = 'E3'
|
os.environ['ENV_DEF'] = 'E3'
|
||||||
|
|
||||||
service_dict = config.make_service_dict(
|
service_dict = config.make_service_dict(
|
||||||
'foo',
|
'foo', {
|
||||||
{
|
|
||||||
'environment': {
|
'environment': {
|
||||||
'FILE_DEF': 'F1',
|
'FILE_DEF': 'F1',
|
||||||
'FILE_DEF_EMPTY': '',
|
'FILE_DEF_EMPTY': '',
|
||||||
|
@ -174,6 +174,7 @@ class EnvTest(unittest.TestCase):
|
||||||
{'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''},
|
{'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtendsTest(unittest.TestCase):
|
class ExtendsTest(unittest.TestCase):
|
||||||
def test_extends(self):
|
def test_extends(self):
|
||||||
service_dicts = config.load('tests/fixtures/extends/docker-compose.yml')
|
service_dicts = config.load('tests/fixtures/extends/docker-compose.yml')
|
||||||
|
@ -231,7 +232,6 @@ class ExtendsTest(unittest.TestCase):
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_extends_validation(self):
|
def test_extends_validation(self):
|
||||||
dictionary = {'extends': None}
|
dictionary = {'extends': None}
|
||||||
load_config = lambda: config.make_service_dict('myweb', dictionary, working_dir='tests/fixtures/extends')
|
load_config = lambda: config.make_service_dict('myweb', dictionary, working_dir='tests/fixtures/extends')
|
||||||
|
|
|
@ -9,7 +9,6 @@ from compose.container import Container
|
||||||
|
|
||||||
class ContainerTest(unittest.TestCase):
|
class ContainerTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.container_dict = {
|
self.container_dict = {
|
||||||
"Id": "abc",
|
"Id": "abc",
|
||||||
|
@ -30,7 +29,9 @@ class ContainerTest(unittest.TestCase):
|
||||||
container = Container.from_ps(None,
|
container = Container.from_ps(None,
|
||||||
self.container_dict,
|
self.container_dict,
|
||||||
has_been_inspected=True)
|
has_been_inspected=True)
|
||||||
self.assertEqual(container.dictionary, {
|
self.assertEqual(
|
||||||
|
container.dictionary,
|
||||||
|
{
|
||||||
"Id": "abc",
|
"Id": "abc",
|
||||||
"Image": "busybox:latest",
|
"Image": "busybox:latest",
|
||||||
"Name": "/composetest_db_1",
|
"Name": "/composetest_db_1",
|
||||||
|
@ -122,10 +123,10 @@ class ContainerTest(unittest.TestCase):
|
||||||
container = Container(None, {
|
container = Container(None, {
|
||||||
"Status": "Up 8 seconds",
|
"Status": "Up 8 seconds",
|
||||||
"HostConfig": {
|
"HostConfig": {
|
||||||
"VolumesFrom": ["volume_id",]
|
"VolumesFrom": ["volume_id"]
|
||||||
},
|
},
|
||||||
}, has_been_inspected=True)
|
}, has_been_inspected=True)
|
||||||
|
|
||||||
self.assertEqual(container.get('Status'), "Up 8 seconds")
|
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)
|
self.assertEqual(container.get('Foo.Bar.DoesNotExist'), None)
|
||||||
|
|
|
@ -8,6 +8,7 @@ from compose import config
|
||||||
import mock
|
import mock
|
||||||
import docker
|
import docker
|
||||||
|
|
||||||
|
|
||||||
class ProjectTest(unittest.TestCase):
|
class ProjectTest(unittest.TestCase):
|
||||||
def test_from_dict(self):
|
def test_from_dict(self):
|
||||||
project = Project.from_dicts('composetest', [
|
project = Project.from_dicts('composetest', [
|
||||||
|
|
|
@ -165,7 +165,8 @@ class ServiceTest(unittest.TestCase):
|
||||||
self.assertFalse('domainname' in opts, 'domainname')
|
self.assertFalse('domainname' in opts, 'domainname')
|
||||||
|
|
||||||
def test_split_domainname_fqdn(self):
|
def test_split_domainname_fqdn(self):
|
||||||
service = Service('foo',
|
service = Service(
|
||||||
|
'foo',
|
||||||
hostname='name.domain.tld',
|
hostname='name.domain.tld',
|
||||||
client=self.mock_client)
|
client=self.mock_client)
|
||||||
self.mock_client.containers.return_value = []
|
self.mock_client.containers.return_value = []
|
||||||
|
@ -174,7 +175,8 @@ class ServiceTest(unittest.TestCase):
|
||||||
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
|
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
|
||||||
|
|
||||||
def test_split_domainname_both(self):
|
def test_split_domainname_both(self):
|
||||||
service = Service('foo',
|
service = Service(
|
||||||
|
'foo',
|
||||||
hostname='name',
|
hostname='name',
|
||||||
domainname='domain.tld',
|
domainname='domain.tld',
|
||||||
client=self.mock_client)
|
client=self.mock_client)
|
||||||
|
@ -184,7 +186,8 @@ class ServiceTest(unittest.TestCase):
|
||||||
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
|
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
|
||||||
|
|
||||||
def test_split_domainname_weird(self):
|
def test_split_domainname_weird(self):
|
||||||
service = Service('foo',
|
service = Service(
|
||||||
|
'foo',
|
||||||
hostname='name.sub',
|
hostname='name.sub',
|
||||||
domainname='domain.tld',
|
domainname='domain.tld',
|
||||||
client=self.mock_client)
|
client=self.mock_client)
|
||||||
|
@ -315,4 +318,3 @@ class ServiceVolumesTest(unittest.TestCase):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
binding,
|
binding,
|
||||||
('/home/user', dict(bind='/home/user', ro=False)))
|
('/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 compose.cli.utils import split_buffer
|
||||||
from .. import unittest
|
from .. import unittest
|
||||||
|
|
||||||
|
|
||||||
class SplitBufferTest(unittest.TestCase):
|
class SplitBufferTest(unittest.TestCase):
|
||||||
def test_single_line_chunks(self):
|
def test_single_line_chunks(self):
|
||||||
def reader():
|
def reader():
|
||||||
|
|
Loading…
Reference in New Issue