diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py index 905af40f..a50e548c 100644 --- a/glance_store/_drivers/cinder.py +++ b/glance_store/_drivers/cinder.py @@ -102,7 +102,7 @@ def get_cinderclient(conf, context): class StoreLocation(glance_store.location.StoreLocation): - """Class describing a Cinder URI""" + """Class describing a Cinder URI.""" def process_specs(self): self.scheme = self.specs.get('scheme', 'cinder') diff --git a/glance_store/_drivers/filesystem.py b/glance_store/_drivers/filesystem.py index 372a06e9..fdbe9795 100644 --- a/glance_store/_drivers/filesystem.py +++ b/glance_store/_drivers/filesystem.py @@ -110,7 +110,7 @@ class ChunkedFile(object): self.fp.seek(offset) def __iter__(self): - """Return an iterator over the image file""" + """Return an iterator over the image file.""" try: if self.fp: while True: diff --git a/glance_store/_drivers/http.py b/glance_store/_drivers/http.py index e391c513..0da44091 100644 --- a/glance_store/_drivers/http.py +++ b/glance_store/_drivers/http.py @@ -31,7 +31,7 @@ MAX_REDIRECTS = 5 class StoreLocation(glance_store.location.StoreLocation): - """Class describing an HTTP(S) URI""" + """Class describing an HTTP(S) URI.""" def process_specs(self): self.scheme = self.specs.get('scheme', 'http') diff --git a/glance_store/_drivers/s3.py b/glance_store/_drivers/s3.py index fdc5b20c..c6a7fc45 100644 --- a/glance_store/_drivers/s3.py +++ b/glance_store/_drivers/s3.py @@ -179,7 +179,7 @@ class ChunkedFile(object): self.chunk_size = chunk_size def __iter__(self): - """Return an iterator over the image file""" + """Return an iterator over the image file.""" try: if self.fp: while True: diff --git a/glance_store/backend.py b/glance_store/backend.py index 2bf72e0e..eef3efcc 100644 --- a/glance_store/backend.py +++ b/glance_store/backend.py @@ -132,7 +132,7 @@ class Indexable(object): return self.chunk def another(self): - """Implemented by subclasses to return the next element""" + """Implemented by subclasses to return the next element.""" raise NotImplementedError def getvalue(self): @@ -222,7 +222,7 @@ def verify_default_store(): def get_known_schemes(): - """Returns list of known schemes""" + """Returns list of known schemes.""" return location.SCHEME_TO_CLS_MAP.keys() @@ -249,7 +249,7 @@ def get_store_from_uri(uri): def get_from_backend(uri, offset=0, chunk_size=None, context=None): - """Yields chunks of data from backend specified by uri""" + """Yields chunks of data from backend specified by uri.""" loc = location.get_location_from_uri(uri) store = get_store_from_uri(uri) @@ -263,7 +263,7 @@ def get_from_backend(uri, offset=0, chunk_size=None, context=None): def get_size_from_backend(uri, context=None): - """Retrieves image size from backend specified by uri""" + """Retrieves image size from backend specified by uri.""" loc = location.get_location_from_uri(uri) store = get_store_from_uri(uri) @@ -272,7 +272,7 @@ def get_size_from_backend(uri, context=None): def delete_from_backend(uri, context=None): - """Removes chunks of data from backend specified by uri""" + """Removes chunks of data from backend specified by uri.""" loc = location.get_location_from_uri(uri) store = get_store_from_uri(uri) diff --git a/tests/unit/test_filesystem_store.py b/tests/unit/test_filesystem_store.py index bd57918a..2961b313 100644 --- a/tests/unit/test_filesystem_store.py +++ b/tests/unit/test_filesystem_store.py @@ -130,7 +130,7 @@ class TestStore(base.StoreBaseTest): loc) def test_add(self): - """Test that we can add an image via the filesystem backend""" + """Test that we can add an image via the filesystem backend.""" ChunkedFile.CHUNKSIZE = 1024 expected_image_id = str(uuid.uuid4()) expected_file_size = 5 * KB # 5K diff --git a/tests/unit/test_gridfs_store.py b/tests/unit/test_gridfs_store.py index d9aa9970..811584c9 100644 --- a/tests/unit/test_gridfs_store.py +++ b/tests/unit/test_gridfs_store.py @@ -78,7 +78,7 @@ class FakeGridFS(object): class TestStore(base.StoreBaseTest): def setUp(self): - """Establish a clean test environment""" + """Establish a clean test environment.""" super(TestStore, self).setUp() if pymongo is not None: diff --git a/tests/unit/test_rbd_store.py b/tests/unit/test_rbd_store.py index 6d1a5341..ae164b7c 100644 --- a/tests/unit/test_rbd_store.py +++ b/tests/unit/test_rbd_store.py @@ -143,7 +143,7 @@ class MockRBD(object): class TestStore(base.StoreBaseTest): def setUp(self): - """Establish a clean test environment""" + """Establish a clean test environment.""" super(TestStore, self).setUp() rbd_store.rados = MockRados diff --git a/tests/unit/test_s3_store.py b/tests/unit/test_s3_store.py index 4e5f5620..a66ce6be 100644 --- a/tests/unit/test_s3_store.py +++ b/tests/unit/test_s3_store.py @@ -148,7 +148,7 @@ def format_s3_location(user, key, authurl, bucket, obj): class TestStore(base.StoreBaseTest): def setUp(self): - """Establish a clean test environment""" + """Establish a clean test environment.""" super(TestStore, self).setUp() self.store = s3.Store(self.conf) self.config(**S3_CONF) @@ -168,7 +168,7 @@ class TestStore(base.StoreBaseTest): self.addCleanup(bucket.stop) def test_get(self): - """Test a "normal" retrieval of an image in chunks""" + """Test a "normal" retrieval of an image in chunks.""" loc = get_location_from_uri( "s3://user:key@auth_address/glance/%s" % FAKE_UUID) (image_s3, image_size) = self.store.get(loc) @@ -183,7 +183,7 @@ class TestStore(base.StoreBaseTest): self.assertEqual(expected_data, data) def test_get_calling_format_path(self): - """Test a "normal" retrieval of an image in chunks""" + """Test a "normal" retrieval of an image in chunks.""" self.config(s3_store_bucket_url_format='path') def fake_S3Connection_init(*args, **kwargs): @@ -199,7 +199,7 @@ class TestStore(base.StoreBaseTest): (image_s3, image_size) = self.store.get(loc) def test_get_calling_format_default(self): - """Test a "normal" retrieval of an image in chunks""" + """Test a "normal" retrieval of an image in chunks.""" def fake_S3Connection_init(*args, **kwargs): expected_cls = boto.s3.connection.SubdomainCallingFormat @@ -227,7 +227,7 @@ class TestStore(base.StoreBaseTest): self.assertRaises(exceptions.NotFound, self.store.get, loc) def test_add(self): - """Test that we can add an image via the s3 backend""" + """Test that we can add an image via the s3 backend.""" expected_image_id = str(uuid.uuid4()) expected_s3_size = FIVE_KB expected_s3_contents = "*" * expected_s3_size diff --git a/tests/unit/test_sheepdog_store.py b/tests/unit/test_sheepdog_store.py index 4f2959b4..4384cf38 100644 --- a/tests/unit/test_sheepdog_store.py +++ b/tests/unit/test_sheepdog_store.py @@ -25,7 +25,7 @@ from glance_store.tests import base class TestSheepdogStore(base.StoreBaseTest): def setUp(self): - """Establish a clean test environment""" + """Establish a clean test environment.""" super(TestSheepdogStore, self).setUp() def _fake_execute(*cmd, **kwargs): diff --git a/tests/unit/test_swift_store.py b/tests/unit/test_swift_store.py index f6b47156..1724172b 100644 --- a/tests/unit/test_swift_store.py +++ b/tests/unit/test_swift_store.py @@ -269,7 +269,7 @@ class SwiftTests(object): self.assertEqual(size, 5120) def test_get(self): - """Test a "normal" retrieval of an image in chunks""" + """Test a "normal" retrieval of an image in chunks.""" uri = "swift://%s:key@auth_address/glance/%s" % ( self.swift_store_user, FAKE_UUID) loc = get_location_from_uri(uri) @@ -344,7 +344,7 @@ class SwiftTests(object): '.is_multiple_swift_store_accounts_enabled', mock.Mock(return_value=False)) def test_add(self): - """Test that we can add an image via the swift backend""" + """Test that we can add an image via the swift backend.""" reload(swift) self.store = Store(self.conf) self.store.configure() @@ -775,7 +775,7 @@ class TestStoreAuthV1(base.StoreBaseTest, SwiftTests): return conf def setUp(self): - """Establish a clean test environment""" + """Establish a clean test environment.""" super(TestStoreAuthV1, self).setUp() conf = self.getConfig() diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index f08345e8..6bfb0896 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -19,7 +19,7 @@ from glance_store.common import utils class TestUtils(base.BaseTestCase): - """Test routines in glance_store.common.utils""" + """Test routines in glance_store.common.utils.""" def test_exception_to_str(self): class FakeException(Exception): diff --git a/tests/unit/test_vmware_store.py b/tests/unit/test_vmware_store.py index a952d838..df040457 100644 --- a/tests/unit/test_vmware_store.py +++ b/tests/unit/test_vmware_store.py @@ -81,7 +81,7 @@ class TestStore(base.StoreBaseTest): @mock.patch('oslo.vmware.api.VMwareAPISession', auptospec=True) def setUp(self, mock_session): - """Establish a clean test environment""" + """Establish a clean test environment.""" super(TestStore, self).setUp() vm_store.Store.CHUNKSIZE = 2 @@ -131,7 +131,7 @@ class TestStore(base.StoreBaseTest): vm_store.Store._build_vim_cookie_header = mock.Mock() def test_get(self): - """Test a "normal" retrieval of an image in chunks""" + """Test a "normal" retrieval of an image in chunks.""" expected_image_size = 31 expected_returns = ['I ', 'am', ' a', ' t', 'ea', 'po', 't,', ' s', 'ho', 'rt', ' a', 'nd', ' s', 'to', 'ut', '\n'] @@ -158,7 +158,7 @@ class TestStore(base.StoreBaseTest): @mock.patch.object(vm_store._Reader, 'size') def test_add(self, fake_size): - """Test that we can add an image via the VMware backend""" + """Test that we can add an image via the VMware backend.""" expected_image_id = str(uuid.uuid4()) expected_size = FIVE_KB expected_contents = "*" * expected_size @@ -215,7 +215,7 @@ class TestStore(base.StoreBaseTest): self.assertEqual(expected_checksum, checksum) def test_delete(self): - """Test we can delete an existing image in the VMware store""" + """Test we can delete an existing image in the VMware store.""" loc = get_location_from_uri( "vsphere://127.0.0.1/folder/openstack_glance/%s?" "dsName=ds1&dcPath=dc1" % FAKE_UUID) @@ -228,7 +228,9 @@ class TestStore(base.StoreBaseTest): self.assertRaises(exceptions.NotFound, self.store.get, loc) def test_get_size(self): - """Test we can get the size of an existing image in the VMware store""" + """ + Test we can get the size of an existing image in the VMware store + """ loc = get_location_from_uri( "vsphere://127.0.0.1/folder/openstack_glance/%s" "?dsName=ds1&dcPath=dc1" % FAKE_UUID) diff --git a/tox.ini b/tox.ini index 7abe2fd7..eb9f3373 100644 --- a/tox.ini +++ b/tox.ini @@ -31,8 +31,7 @@ commands = {posargs} # E712 comparison to True should be 'if cond is True:' or 'if cond:' # F841 local variable 'name' assigned but never used # H301 one import per line -# H402 one line docstring needs punctuation. # H404 multi line docstring should start with a summary -ignore = E711,E712,F841,H301,H402,H404 +ignore = E711,E712,F841,H301,H404 builtins = _ exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*openstack/common*,*lib/python*,*egg,build