mirror of https://github.com/docker/docker-py.git
Fixes for flake8
Next rules were broken * E265 block comment should start with '# ' * E713 test for membership should be 'not in'
This commit is contained in:
parent
24cc9df5f5
commit
2a1484f655
|
@ -48,7 +48,7 @@ def resolve_repository_name(repo_name):
|
||||||
raise ValueError('Repository name cannot contain a '
|
raise ValueError('Repository name cannot contain a '
|
||||||
'scheme ({0})'.format(repo_name))
|
'scheme ({0})'.format(repo_name))
|
||||||
parts = repo_name.split('/', 1)
|
parts = repo_name.split('/', 1)
|
||||||
if not '.' in parts[0] and not ':' in parts[0] and parts[0] != 'localhost':
|
if '.' not in parts[0] and ':' not in parts[0] and parts[0] != 'localhost':
|
||||||
# This is a docker index repo (ex: foo/bar or ubuntu)
|
# This is a docker index repo (ex: foo/bar or ubuntu)
|
||||||
return INDEX_URL, repo_name
|
return INDEX_URL, repo_name
|
||||||
if len(parts) < 2:
|
if len(parts) < 2:
|
||||||
|
|
|
@ -40,7 +40,7 @@ class UnixHTTPConnection(httplib.HTTPConnection, object):
|
||||||
self.sock = sock
|
self.sock = sock
|
||||||
|
|
||||||
def _extract_path(self, url):
|
def _extract_path(self, url):
|
||||||
#remove the base_url entirely..
|
# remove the base_url entirely..
|
||||||
return url.replace(self.base_url, "")
|
return url.replace(self.base_url, "")
|
||||||
|
|
||||||
def request(self, method, url, **kwargs):
|
def request(self, method, url, **kwargs):
|
||||||
|
|
|
@ -24,8 +24,8 @@ FAKE_FILE_NAME = 'file'
|
||||||
FAKE_URL = 'myurl'
|
FAKE_URL = 'myurl'
|
||||||
FAKE_PATH = '/path'
|
FAKE_PATH = '/path'
|
||||||
|
|
||||||
### Each method is prefixed with HTTP method (get, post...)
|
# Each method is prefixed with HTTP method (get, post...)
|
||||||
### for clarity and readability
|
# for clarity and readability
|
||||||
|
|
||||||
|
|
||||||
def get_fake_version():
|
def get_fake_version():
|
||||||
|
@ -278,7 +278,7 @@ def post_fake_tag_image():
|
||||||
return status_code, response
|
return status_code, response
|
||||||
|
|
||||||
|
|
||||||
## maps real api url to fake response callback
|
# Maps real api url to fake response callback
|
||||||
prefix = 'http+unix://var/run/docker.sock'
|
prefix = 'http+unix://var/run/docker.sock'
|
||||||
fake_responses = {
|
fake_responses = {
|
||||||
'{1}/{0}/version'.format(CURRENT_VERSION, prefix):
|
'{1}/{0}/version'.format(CURRENT_VERSION, prefix):
|
||||||
|
|
|
@ -51,7 +51,7 @@ class BaseTestCase(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
## INFORMATION TESTS ##
|
# INFORMATION TESTS #
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class TestSearch(BaseTestCase):
|
||||||
self.assertIn('description', base_img[0])
|
self.assertIn('description', base_img[0])
|
||||||
|
|
||||||
###################
|
###################
|
||||||
## LISTING TESTS ##
|
# LISTING TESTS #
|
||||||
###################
|
###################
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class TestListContainers(BaseTestCase):
|
||||||
self.assertIn('Status', retrieved)
|
self.assertIn('Status', retrieved)
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
## CONTAINER TESTS ##
|
# CONTAINER TESTS #
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ class TestPort(BaseTestCase):
|
||||||
|
|
||||||
self.client.start(container, port_bindings=port_bindings)
|
self.client.start(container, port_bindings=port_bindings)
|
||||||
|
|
||||||
#Call the port function on each biding and compare expected vs actual
|
# Call the port function on each biding and compare expected vs actual
|
||||||
for port in port_bindings:
|
for port in port_bindings:
|
||||||
actual_bindings = self.client.port(container, port)
|
actual_bindings = self.client.port(container, port)
|
||||||
port_binding = actual_bindings.pop()
|
port_binding = actual_bindings.pop()
|
||||||
|
@ -561,7 +561,7 @@ class TestStartContainerWithLinks(BaseTestCase):
|
||||||
self.assertIn('{0}_ENV_FOO=1'.format(link_env_prefix2), logs)
|
self.assertIn('{0}_ENV_FOO=1'.format(link_env_prefix2), logs)
|
||||||
|
|
||||||
#################
|
#################
|
||||||
## LINKS TESTS ##
|
# LINKS TESTS #
|
||||||
#################
|
#################
|
||||||
|
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ class TestRemoveLink(BaseTestCase):
|
||||||
self.assertEqual(len(retrieved), 2)
|
self.assertEqual(len(retrieved), 2)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
## IMAGES TESTS ##
|
# IMAGES TESTS #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ class TestBuildFromStringIO(BaseTestCase):
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
## PY SPECIFIC TESTS ##
|
# PY SPECIFIC TESTS #
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class DockerClientTest(unittest.TestCase):
|
||||||
self.client._cfg = {'Configs': {}}
|
self.client._cfg = {'Configs': {}}
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
## INFORMATION TESTS ##
|
# INFORMATION TESTS #
|
||||||
#########################
|
#########################
|
||||||
def test_version(self):
|
def test_version(self):
|
||||||
try:
|
try:
|
||||||
|
@ -112,7 +112,7 @@ class DockerClientTest(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
###################
|
###################
|
||||||
## LISTING TESTS ##
|
# LISTING TESTS #
|
||||||
###################
|
###################
|
||||||
|
|
||||||
def test_images(self):
|
def test_images(self):
|
||||||
|
@ -168,7 +168,7 @@ class DockerClientTest(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
## CONTAINER TESTS ##
|
# CONTAINER TESTS #
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
def test_create_container(self):
|
def test_create_container(self):
|
||||||
|
@ -192,7 +192,6 @@ class DockerClientTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_create_container_with_binds(self):
|
def test_create_container_with_binds(self):
|
||||||
mount_dest = '/mnt'
|
mount_dest = '/mnt'
|
||||||
#mount_origin = '/tmp'
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.client.create_container('busybox', ['ls', mount_dest],
|
self.client.create_container('busybox', ['ls', mount_dest],
|
||||||
|
@ -905,7 +904,7 @@ class DockerClientTest(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
## IMAGES TESTS ##
|
# IMAGES TESTS #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
def test_pull(self):
|
def test_pull(self):
|
||||||
|
@ -1192,7 +1191,7 @@ class DockerClientTest(unittest.TestCase):
|
||||||
self.fail('Command should not raise exception: {0}'.format(e))
|
self.fail('Command should not raise exception: {0}'.format(e))
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
## PY SPECIFIC TESTS ##
|
# PY SPECIFIC TESTS #
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
def test_load_config_no_file(self):
|
def test_load_config_no_file(self):
|
||||||
|
|
Loading…
Reference in New Issue