Pylint cleanup
This commit is contained in:
parent
84a6d4cd0e
commit
3cf3746739
doc/source
tests
tools
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2010 OpenStack, LLC.
|
||||
# Copyright (c) 2011 OpenStack, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -35,7 +35,7 @@ import sys
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.append([os.path.abspath('../glance'),
|
||||
os.path.abspath('..'),
|
||||
os.path.abspath('../bin')
|
||||
os.path.abspath('../bin'),
|
||||
])
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
@ -117,7 +117,7 @@ pygments_style = 'sphinx'
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
modindex_common_prefix = ['glance.']
|
||||
|
||||
# -- Options for man page output -----------------------------------------------
|
||||
# -- Options for man page output --------------------------------------------
|
||||
|
||||
# Grouping the document tree for man pages.
|
||||
# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual'
|
||||
@ -126,7 +126,7 @@ man_pages = [
|
||||
('man/glanceapi', 'glance-api', u'Glance API Server',
|
||||
[u'OpenStack'], 1),
|
||||
('man/glanceregistry', 'glance-registry', u'Glance Registry Server',
|
||||
[u'OpenStack'], 1)
|
||||
[u'OpenStack'], 1),
|
||||
]
|
||||
|
||||
|
||||
|
@ -117,6 +117,7 @@ def stub_out_s3_backend(stubs):
|
||||
|
||||
class FakeSwiftAuth(object):
|
||||
pass
|
||||
|
||||
class FakeS3Connection(object):
|
||||
pass
|
||||
|
||||
@ -134,8 +135,7 @@ def stub_out_s3_backend(stubs):
|
||||
|
||||
def chunk_it():
|
||||
for i in xrange(0, len(cls.DATA), cls.CHUNK_SIZE):
|
||||
yield cls.DATA[i:i+cls.CHUNK_SIZE]
|
||||
|
||||
yield cls.DATA[i:i + cls.CHUNK_SIZE]
|
||||
return chunk_it()
|
||||
|
||||
fake_swift_backend = FakeS3Backend()
|
||||
@ -201,8 +201,7 @@ def stub_out_registry(stubs):
|
||||
DATA = \
|
||||
{'files': [
|
||||
{'location': 'file:///chunk0', 'size': 12345},
|
||||
{'location': 'file:///chunk1', 'size': 1235}
|
||||
]}
|
||||
{'location': 'file:///chunk1', 'size': 1235}]}
|
||||
|
||||
@classmethod
|
||||
def lookup(cls, _parsed_uri):
|
||||
|
@ -88,8 +88,8 @@ class TestRegistryAPI(unittest.TestCase):
|
||||
'name': 'fake image #2',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'active'
|
||||
}
|
||||
'status': 'active'}
|
||||
|
||||
req = webob.Request.blank('/images/detail')
|
||||
res = req.get_response(rserver.API())
|
||||
res_dict = json.loads(res.body)
|
||||
@ -105,8 +105,7 @@ class TestRegistryAPI(unittest.TestCase):
|
||||
"""Tests that the /images POST registry API creates the image"""
|
||||
fixture = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel'
|
||||
}
|
||||
'type': 'kernel'}
|
||||
|
||||
req = webob.Request.blank('/images')
|
||||
|
||||
@ -134,8 +133,7 @@ class TestRegistryAPI(unittest.TestCase):
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'bad status'
|
||||
}
|
||||
'status': 'bad status'}
|
||||
|
||||
req = webob.Request.blank('/images')
|
||||
|
||||
@ -151,8 +149,7 @@ class TestRegistryAPI(unittest.TestCase):
|
||||
def test_update_image(self):
|
||||
"""Tests that the /images PUT registry API updates the image"""
|
||||
fixture = {'name': 'fake public image #2',
|
||||
'type': 'ramdisk'
|
||||
}
|
||||
'type': 'ramdisk'}
|
||||
|
||||
req = webob.Request.blank('/images/2')
|
||||
|
||||
@ -175,8 +172,7 @@ class TestRegistryAPI(unittest.TestCase):
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'bad status'
|
||||
}
|
||||
'status': 'bad status'}
|
||||
|
||||
req = webob.Request.blank('/images/3')
|
||||
|
||||
|
@ -161,15 +161,13 @@ class TestRegistryClient(unittest.TestCase):
|
||||
'type': 'kernel',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}}
|
||||
expected = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}}
|
||||
|
||||
new_image = self.client.add_image(fixture)
|
||||
|
||||
@ -216,8 +214,7 @@ class TestRegistryClient(unittest.TestCase):
|
||||
def test_update_image(self):
|
||||
"""Tests that the /images PUT registry API updates the image"""
|
||||
fixture = {'name': 'fake public image #2',
|
||||
'type': 'ramdisk'
|
||||
}
|
||||
'type': 'ramdisk'}
|
||||
|
||||
self.assertTrue(self.client.update_image(2, fixture))
|
||||
|
||||
@ -233,7 +230,7 @@ class TestRegistryClient(unittest.TestCase):
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'bad status'
|
||||
'status': 'bad status',
|
||||
}
|
||||
|
||||
self.assertRaises(exception.NotFound,
|
||||
@ -386,9 +383,8 @@ class TestClient(unittest.TestCase):
|
||||
"""Tests client returns image as queued"""
|
||||
fixture = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel'
|
||||
'type': 'kernel',
|
||||
}
|
||||
|
||||
image_meta = self.client.add_image(fixture)
|
||||
self.assertEquals('queued', image_meta['status'])
|
||||
self.assertEquals(0, image_meta['size'])
|
||||
@ -401,7 +397,6 @@ class TestClient(unittest.TestCase):
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
}
|
||||
|
||||
new_image = self.client.add_image(fixture)
|
||||
new_image_id = new_image['id']
|
||||
|
||||
@ -425,16 +420,15 @@ class TestClient(unittest.TestCase):
|
||||
'type': 'kernel',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'},
|
||||
}
|
||||
expected = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'},
|
||||
}
|
||||
|
||||
new_image = self.client.add_image(fixture)
|
||||
new_image_id = new_image['id']
|
||||
|
||||
@ -485,7 +479,7 @@ class TestClient(unittest.TestCase):
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'size': 19,
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'},
|
||||
}
|
||||
|
||||
image_data_fixture = r"chunk00000remainder"
|
||||
@ -510,7 +504,7 @@ class TestClient(unittest.TestCase):
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'size': 19,
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'},
|
||||
}
|
||||
|
||||
image_data_fixture = r"chunk00000remainder"
|
||||
@ -546,7 +540,7 @@ class TestClient(unittest.TestCase):
|
||||
fixture = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'},
|
||||
}
|
||||
|
||||
image_data_fixture = r"chunk00000remainder"
|
||||
@ -574,7 +568,7 @@ class TestClient(unittest.TestCase):
|
||||
'type': 'kernel',
|
||||
'size': 19,
|
||||
'store': 'bad',
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'}
|
||||
'properties': {'distro': 'Ubuntu 10.04 LTS'},
|
||||
}
|
||||
|
||||
image_data_fixture = r"chunk00000remainder"
|
||||
@ -587,7 +581,7 @@ class TestClient(unittest.TestCase):
|
||||
def test_update_image(self):
|
||||
"""Tests that the /images PUT registry API updates the image"""
|
||||
fixture = {'name': 'fake public image #2',
|
||||
'type': 'ramdisk'
|
||||
'type': 'ramdisk',
|
||||
}
|
||||
|
||||
self.assertTrue(self.client.update_image(2, fixture))
|
||||
@ -604,7 +598,7 @@ class TestClient(unittest.TestCase):
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'bad status'
|
||||
'status': 'bad status',
|
||||
}
|
||||
|
||||
self.assertRaises(exception.NotFound,
|
||||
|
@ -80,7 +80,7 @@ class TestImageController(unittest.TestCase):
|
||||
'name': 'fake image #2',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'active'
|
||||
'status': 'active',
|
||||
}
|
||||
req = webob.Request.blank('/images/detail')
|
||||
res = req.get_response(server.API())
|
||||
@ -97,7 +97,7 @@ class TestImageController(unittest.TestCase):
|
||||
"""Tests that the /images POST registry API creates the image"""
|
||||
fixture = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel'
|
||||
'type': 'kernel',
|
||||
}
|
||||
|
||||
req = webob.Request.blank('/images')
|
||||
@ -126,7 +126,7 @@ class TestImageController(unittest.TestCase):
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'bad status'
|
||||
'status': 'bad status',
|
||||
}
|
||||
|
||||
req = webob.Request.blank('/images')
|
||||
@ -143,7 +143,7 @@ class TestImageController(unittest.TestCase):
|
||||
def test_update_image(self):
|
||||
"""Tests that the /images PUT registry API updates the image"""
|
||||
fixture = {'name': 'fake public image #2',
|
||||
'type': 'ramdisk'
|
||||
'type': 'ramdisk',
|
||||
}
|
||||
|
||||
req = webob.Request.blank('/images/2')
|
||||
@ -167,7 +167,7 @@ class TestImageController(unittest.TestCase):
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'type': 'kernel',
|
||||
'status': 'bad status'
|
||||
'status': 'bad status',
|
||||
}
|
||||
|
||||
req = webob.Request.blank('/images/3')
|
||||
|
@ -106,9 +106,7 @@ class TestS3Backend(TestBackend):
|
||||
self.assertEqual(chunks, expected_returns)
|
||||
|
||||
|
||||
|
||||
class TestSwiftBackend(TestBackend):
|
||||
|
||||
def setUp(self):
|
||||
super(TestSwiftBackend, self).setUp()
|
||||
stubs.stub_out_swift_backend(self.stubs)
|
||||
|
@ -30,7 +30,7 @@ PIP_REQUIRES = os.path.join(ROOT, 'tools', 'pip-requires')
|
||||
|
||||
|
||||
def die(message, *args):
|
||||
print >>sys.stderr, message % args
|
||||
print >> sys.stderr, message % args
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user