From c067abd21ee05ae96b0f70c6058efc1bfde10de4 Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Sat, 31 Aug 2013 22:36:58 -0400 Subject: [PATCH] Pep8 unit test modules for hacking and one liners (4 of 12) Address all the "hacking" lines that are flagged, and all the modules that just have one item flagged. Change-Id: I372a4bdf9c7748f73e38c4fd55e5954f1afade5b Signed-off-by: Peter Portante --- test/unit/__init__.py | 1 + test/unit/account/test_reaper.py | 2 +- test/unit/account/test_server.py | 29 ++++------- test/unit/common/middleware/test_tempauth.py | 2 +- test/unit/common/ring/test_builder.py | 2 +- test/unit/common/test_bench.py | 2 +- test/unit/common/test_daemon.py | 6 +-- test/unit/common/test_db.py | 4 +- test/unit/common/test_exceptions.py | 2 +- test/unit/common/test_manager.py | 2 +- test/unit/common/test_memcached.py | 7 +-- test/unit/common/test_utils.py | 14 ++--- test/unit/common/test_wsgi.py | 4 +- test/unit/container/test_server.py | 29 ++++------- test/unit/obj/test_auditor.py | 5 +- test/unit/obj/test_diskfile.py | 6 +-- test/unit/obj/test_expirer.py | 2 +- test/unit/obj/test_server.py | 55 +++++++++----------- 18 files changed, 77 insertions(+), 97 deletions(-) diff --git a/test/unit/__init__.py b/test/unit/__init__.py index 1e75eb8da3..735ca749cb 100644 --- a/test/unit/__init__.py +++ b/test/unit/__init__.py @@ -17,6 +17,7 @@ from eventlet import sleep, Timeout import logging.handlers from httplib import HTTPException + class FakeRing(object): def __init__(self, replicas=3, max_more_nodes=0): diff --git a/test/unit/account/test_reaper.py b/test/unit/account/test_reaper.py index 858dadf4af..3861daf218 100644 --- a/test/unit/account/test_reaper.py +++ b/test/unit/account/test_reaper.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO: Tests +# TODO(creiht): Tests import unittest diff --git a/test/unit/account/test_server.py b/test/unit/account/test_server.py index 11d436f67c..a67da9da7f 100644 --- a/test/unit/account/test_server.py +++ b/test/unit/account/test_server.py @@ -29,15 +29,15 @@ from swift.common.utils import normalize_timestamp, replication, public class TestAccountController(unittest.TestCase): - """ Test swift.account_server.AccountController """ + """Test swift.account.server.AccountController""" def setUp(self): - """ Set up for testing swift.account_server.AccountController """ + """Set up for testing swift.account.server.AccountController""" self.testdir = os.path.join(os.path.dirname(__file__), 'account_server') self.controller = AccountController( {'devices': self.testdir, 'mount_check': 'false'}) def tearDown(self): - """ Tear down for testing swift.account_server.AccountController """ + """Tear down for testing swift.account.server.AccountController""" try: rmtree(self.testdir) except OSError, err: @@ -1341,10 +1341,7 @@ class TestAccountController(unittest.TestCase): self.assertEquals(resp.charset, 'utf-8') def test_serv_reserv(self): - """ - Test replication_server flag - was set from configuration file. - """ + # Test replication_server flag was set from configuration file. conf = {'devices': self.testdir, 'mount_check': 'false'} self.assertEquals(AccountController(conf).replication_server, None) for val in [True, '1', 'True', 'true']: @@ -1355,7 +1352,7 @@ class TestAccountController(unittest.TestCase): self.assertFalse(AccountController(conf).replication_server) def test_list_allowed_methods(self): - """ Test list of allowed_methods """ + # Test list of allowed_methods obj_methods = ['DELETE', 'PUT', 'HEAD', 'GET', 'POST'] repl_methods = ['REPLICATE'] for method_name in obj_methods: @@ -1366,10 +1363,8 @@ class TestAccountController(unittest.TestCase): self.assertEquals(method.replication, True) def test_correct_allowed_method(self): - """ - Test correct work for allowed method using - swift.account_server.AccountController.__call__ - """ + # Test correct work for allowed method using + # swift.account.server.AccountController.__call__ inbuf = StringIO() errbuf = StringIO() outbuf = StringIO() @@ -1378,7 +1373,7 @@ class TestAccountController(unittest.TestCase): 'replication_server': 'false'}) def start_response(*args): - """ Sends args to outbuf """ + """Sends args to outbuf""" outbuf.writelines(args) method = 'PUT' @@ -1406,10 +1401,8 @@ class TestAccountController(unittest.TestCase): self.assertEqual(response, method_res) def test_not_allowed_method(self): - """ - Test correct work for NOT allowed method using - swift.account_server.AccountController.__call__ - """ + # Test correct work for NOT allowed method using + # swift.account.server.AccountController.__call__ inbuf = StringIO() errbuf = StringIO() outbuf = StringIO() @@ -1418,7 +1411,7 @@ class TestAccountController(unittest.TestCase): 'replication_server': 'false'}) def start_response(*args): - """ Sends args to outbuf """ + """Sends args to outbuf""" outbuf.writelines(args) method = 'PUT' diff --git a/test/unit/common/middleware/test_tempauth.py b/test/unit/common/middleware/test_tempauth.py index 312b70c46d..beaf763749 100644 --- a/test/unit/common/middleware/test_tempauth.py +++ b/test/unit/common/middleware/test_tempauth.py @@ -338,7 +338,7 @@ class TestAuth(unittest.TestCase): req = self._make_request('/v1/AUTH_admin', headers={'X-Auth-Token': 'AUTH_t'}) cache_key = 'AUTH_/token/AUTH_t' - cache_entry = (time()+3600, '.reseller_admin') + cache_entry = (time() + 3600, '.reseller_admin') req.environ['swift.cache'].set(cache_key, cache_entry) req.get_response(self.test_auth) self.assertTrue(req.environ.get('reseller_request', False)) diff --git a/test/unit/common/ring/test_builder.py b/test/unit/common/ring/test_builder.py index 0a12fe883e..d272ed7123 100644 --- a/test/unit/common/ring/test_builder.py +++ b/test/unit/common/ring/test_builder.py @@ -565,7 +565,7 @@ class TestRingBuilder(unittest.TestCase): self.assertEquals(counts[3], 256) def test_add_rebalance_add_rebalance_delete_rebalance(self): - """ Test for https://bugs.launchpad.net/swift/+bug/845952 """ + # Test for https://bugs.launchpad.net/swift/+bug/845952 # min_part of 0 to allow for rapid rebalancing rb = ring.RingBuilder(8, 3, 0) rb.add_dev({'id': 0, 'region': 0, 'zone': 0, 'weight': 1, diff --git a/test/unit/common/test_bench.py b/test/unit/common/test_bench.py index d8ae98194c..5364d7975e 100644 --- a/test/unit/common/test_bench.py +++ b/test/unit/common/test_bench.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO: Tests +# TODO(gholt): Tests import unittest diff --git a/test/unit/common/test_daemon.py b/test/unit/common/test_daemon.py index d6a5819628..a0eb6caecb 100644 --- a/test/unit/common/test_daemon.py +++ b/test/unit/common/test_daemon.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO: Test kill_children signal handlers +# TODO(clayg): Test kill_children signal handlers import os import unittest @@ -83,9 +83,7 @@ class TestRunDaemon(unittest.TestCase): self.assertEquals(d.once_called, True) def test_run_daemon(self): - sample_conf = """[my-daemon] -user = %s -""" % getuser() + sample_conf = "[my-daemon]\nuser = %s\n" % getuser() with tmpfile(sample_conf) as conf_file: with patch.dict('os.environ', {'TZ': ''}): daemon.run_daemon(MyDaemon, conf_file) diff --git a/test/unit/common/test_db.py b/test/unit/common/test_db.py index e37a0a6d2a..85e09d60e6 100644 --- a/test/unit/common/test_db.py +++ b/test/unit/common/test_db.py @@ -623,7 +623,7 @@ class TestDatabaseBroker(unittest.TestCase): class TestContainerBroker(unittest.TestCase): - """ Tests for swift.common.db.ContainerBroker """ + """Tests for swift.common.db.ContainerBroker""" def test_creation(self): # Test swift.common.db.ContainerBroker.__init__ @@ -1781,7 +1781,7 @@ class TestContainerBrokerBeforeXSync(TestContainerBroker): class TestAccountBroker(unittest.TestCase): - """ Tests for swift.common.db.AccountBroker """ + """Tests for swift.common.db.AccountBroker""" def test_creation(self): # Test swift.common.db.AccountBroker.__init__ diff --git a/test/unit/common/test_exceptions.py b/test/unit/common/test_exceptions.py index 092ba5b172..a32bf8c22a 100644 --- a/test/unit/common/test_exceptions.py +++ b/test/unit/common/test_exceptions.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO: Tests +# TODO(creiht): Tests import unittest diff --git a/test/unit/common/test_manager.py b/test/unit/common/test_manager.py index 8ae0ef3a2e..4e581c1092 100644 --- a/test/unit/common/test_manager.py +++ b/test/unit/common/test_manager.py @@ -1602,7 +1602,7 @@ class TestManager(unittest.TestCase): manager.Server = _orig_server manager.watch_server_pids = _orig_watch_server_pids - # TODO: more tests + # TODO(clayg): more tests def test_shutdown(self): m = manager.Manager(['test']) m.stop_was_called = False diff --git a/test/unit/common/test_memcached.py b/test/unit/common/test_memcached.py index b866a85ce1..c717e6b870 100644 --- a/test/unit/common/test_memcached.py +++ b/test/unit/common/test_memcached.py @@ -1,4 +1,4 @@ - # -*- coding: utf8 -*- +# -*- coding:utf-8 -*- # Copyright (c) 2010-2012 OpenStack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" Tests for swift.common.utils """ +"""Tests for swift.common.utils""" from __future__ import with_statement import logging @@ -45,6 +45,7 @@ class ExplodingMockMemcached(object): def close(self): pass + class MockMemcached(object): def __init__(self): @@ -139,7 +140,7 @@ class MockMemcached(object): class TestMemcached(unittest.TestCase): - """ Tests for swift.common.memcached""" + """Tests for swift.common.memcached""" def test_get_conns(self): sock1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py index 718a982c80..0236ab5dd5 100644 --- a/test/unit/common/test_utils.py +++ b/test/unit/common/test_utils.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" Tests for swift.common.utils """ +"""Tests for swift.common.utils""" from __future__ import with_statement from test.unit import temptree @@ -130,14 +130,14 @@ def reset_loggers(): class TestUtils(unittest.TestCase): - """ Tests for swift.common.utils """ + """Tests for swift.common.utils """ def setUp(self): utils.HASH_PATH_SUFFIX = 'endcap' utils.HASH_PATH_PREFIX = 'startcap' def test_normalize_timestamp(self): - """ Test swift.common.utils.normalize_timestamp """ + # Test swift.common.utils.normalize_timestamp self.assertEquals(utils.normalize_timestamp('1253327593.48174'), "1253327593.48174") self.assertEquals(utils.normalize_timestamp(1253327593.48174), @@ -158,7 +158,7 @@ class TestUtils(unittest.TestCase): self.assertRaises(ValueError, utils.normalize_timestamp, 'abc') def test_backwards(self): - """ Test swift.common.utils.backward """ + # Test swift.common.utils.backward # The lines are designed so that the function would encounter # all of the boundary conditions and typical conditions. @@ -215,7 +215,7 @@ class TestUtils(unittest.TestCase): os.unlink(testroot) def test_split_path(self): - """ Test swift.common.utils.split_account_path """ + # Test swift.common.utils.split_account_path self.assertRaises(ValueError, utils.split_path, '') self.assertRaises(ValueError, utils.split_path, '/') self.assertRaises(ValueError, utils.split_path, '//') @@ -249,7 +249,7 @@ class TestUtils(unittest.TestCase): self.assertEquals(str(err), 'Invalid path: o%0An%20e') def test_validate_device_partition(self): - """ Test swift.common.utils.validate_device_partition """ + # Test swift.common.utils.validate_device_partition utils.validate_device_partition('foo', 'bar') self.assertRaises(ValueError, utils.validate_device_partition, '', '') @@ -279,7 +279,7 @@ class TestUtils(unittest.TestCase): self.assertEquals(str(err), 'Invalid partition: o%0An%20e') def test_NullLogger(self): - """ Test swift.common.utils.NullLogger """ + # Test swift.common.utils.NullLogger sio = StringIO() nl = utils.NullLogger() nl.write('test') diff --git a/test/unit/common/test_wsgi.py b/test/unit/common/test_wsgi.py index f11ced9e6a..0f080a97c0 100644 --- a/test/unit/common/test_wsgi.py +++ b/test/unit/common/test_wsgi.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" Tests for swift.common.wsgi """ +"""Tests for swift.common.wsgi""" from __future__ import with_statement import errno @@ -66,7 +66,7 @@ def _fake_rings(tmpdir): class TestWSGI(unittest.TestCase): - """ Tests for swift.common.wsgi """ + """Tests for swift.common.wsgi""" def setUp(self): utils.HASH_PATH_PREFIX = 'startcap' diff --git a/test/unit/container/test_server.py b/test/unit/container/test_server.py index da8c2a7b50..45cabb58a6 100644 --- a/test/unit/container/test_server.py +++ b/test/unit/container/test_server.py @@ -44,9 +44,9 @@ def save_globals(): class TestContainerController(unittest.TestCase): - """ Test swift.container_server.ContainerController """ + """Test swift.container.server.ContainerController""" def setUp(self): - """ Set up for testing swift.object_server.ObjectController """ + """Set up for testing swift.object_server.ObjectController""" self.testdir = os.path.join(mkdtemp(), 'tmp_test_object_server_ObjectController') mkdirs(self.testdir) @@ -57,7 +57,7 @@ class TestContainerController(unittest.TestCase): {'devices': self.testdir, 'mount_check': 'false'}) def tearDown(self): - """ Tear down for testing swift.object_server.ObjectController """ + """Tear down for testing swift.object_server.ObjectController""" rmtree(os.path.dirname(self.testdir), ignore_errors=1) def test_acl_container(self): @@ -1468,10 +1468,7 @@ class TestContainerController(unittest.TestCase): 'x-trans-id': '-'})}) def test_serv_reserv(self): - """ - Test replication_server flag - was set from configuration file. - """ + # Test replication_server flag was set from configuration file. container_controller = container_server.ContainerController conf = {'devices': self.testdir, 'mount_check': 'false'} self.assertEquals(container_controller(conf).replication_server, None) @@ -1483,7 +1480,7 @@ class TestContainerController(unittest.TestCase): self.assertFalse(container_controller(conf).replication_server) def test_list_allowed_methods(self): - """ Test list of allowed_methods """ + # Test list of allowed_methods obj_methods = ['DELETE', 'PUT', 'HEAD', 'GET', 'POST'] repl_methods = ['REPLICATE'] for method_name in obj_methods: @@ -1494,10 +1491,8 @@ class TestContainerController(unittest.TestCase): self.assertEquals(method.replication, True) def test_correct_allowed_method(self): - """ - Test correct work for allowed method using - swift.container_server.ContainerController.__call__ - """ + # Test correct work for allowed method using + # swift.container.server.ContainerController.__call__ inbuf = StringIO() errbuf = StringIO() outbuf = StringIO() @@ -1506,7 +1501,7 @@ class TestContainerController(unittest.TestCase): 'replication_server': 'false'}) def start_response(*args): - """ Sends args to outbuf """ + """Sends args to outbuf""" outbuf.writelines(args) method = 'PUT' @@ -1533,10 +1528,8 @@ class TestContainerController(unittest.TestCase): self.assertEqual(response, method_res) def test_not_allowed_method(self): - """ - Test correct work for NOT allowed method using - swift.container_server.ContainerController.__call__ - """ + # Test correct work for NOT allowed method using + # swift.container.server.ContainerController.__call__ inbuf = StringIO() errbuf = StringIO() outbuf = StringIO() @@ -1545,7 +1538,7 @@ class TestContainerController(unittest.TestCase): 'replication_server': 'false'}) def start_response(*args): - """ Sends args to outbuf """ + """Sends args to outbuf""" outbuf.writelines(args) method = 'PUT' diff --git a/test/unit/obj/test_auditor.py b/test/unit/obj/test_auditor.py index c5080b6251..6895d830bd 100644 --- a/test/unit/obj/test_auditor.py +++ b/test/unit/obj/test_auditor.py @@ -274,8 +274,9 @@ class TestAuditor(unittest.TestCase): if with_ts: name_hash = hash_path('a', 'c', 'o') - dir_path = os.path.join(self.devices, 'sda', - storage_directory(DATADIR, '0', name_hash)) + dir_path = os.path.join( + self.devices, 'sda', + storage_directory(DATADIR, '0', name_hash)) ts_file_path = os.path.join(dir_path, '99999.ts') if not os.path.exists(dir_path): mkdirs(dir_path) diff --git a/test/unit/obj/test_diskfile.py b/test/unit/obj/test_diskfile.py index 9d769957c8..5c8c335f15 100644 --- a/test/unit/obj/test_diskfile.py +++ b/test/unit/obj/test_diskfile.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" Tests for swift.obj.diskfile """ +"""Tests for swift.obj.diskfile""" from __future__ import with_statement @@ -353,14 +353,14 @@ class TestDiskFile(unittest.TestCase): """Test swift.obj.diskfile.DiskFile""" def setUp(self): - """ Set up for testing swift.obj.diskfile""" + """Set up for testing swift.obj.diskfile""" self.testdir = os.path.join(mkdtemp(), 'tmp_test_obj_server_DiskFile') mkdirs(os.path.join(self.testdir, 'sda1', 'tmp')) self._orig_tpool_exc = tpool.execute tpool.execute = lambda f, *args, **kwargs: f(*args, **kwargs) def tearDown(self): - """ Tear down for testing swift.obj.diskfile""" + """Tear down for testing swift.obj.diskfile""" rmtree(os.path.dirname(self.testdir)) tpool.execute = self._orig_tpool_exc diff --git a/test/unit/obj/test_expirer.py b/test/unit/obj/test_expirer.py index 9650400d68..ec65159286 100644 --- a/test/unit/obj/test_expirer.py +++ b/test/unit/obj/test_expirer.py @@ -123,7 +123,7 @@ class TestObjectExpirer(TestCase): self.deleted_objects = {} def delete_object(self, actual_obj, timestamp, container, obj): - if not container in self.deleted_objects: + if container not in self.deleted_objects: self.deleted_objects[container] = set() self.deleted_objects[container].add(obj) diff --git a/test/unit/obj/test_server.py b/test/unit/obj/test_server.py index c1714aabc7..dc76de841a 100755 --- a/test/unit/obj/test_server.py +++ b/test/unit/obj/test_server.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" Tests for swift.obj.server """ +"""Tests for swift.obj.server""" import cPickle as pickle import operator @@ -42,10 +42,10 @@ from swift.common.swob import Request, HeaderKeyDict class TestObjectController(unittest.TestCase): - """ Test swift.obj.server.ObjectController """ + """Test swift.obj.server.ObjectController""" def setUp(self): - """ Set up for testing swift.object_server.ObjectController """ + """Set up for testing swift.object.server.ObjectController""" utils.HASH_PATH_SUFFIX = 'endcap' utils.HASH_PATH_PREFIX = 'startcap' self.testdir = \ @@ -58,7 +58,7 @@ class TestObjectController(unittest.TestCase): tpool.execute = lambda f, *args, **kwargs: f(*args, **kwargs) def tearDown(self): - """ Tear down for testing swift.object_server.ObjectController """ + """Tear down for testing swift.object.server.ObjectController""" rmtree(os.path.dirname(self.testdir)) tpool.execute = self._orig_tpool_exc @@ -110,7 +110,7 @@ class TestObjectController(unittest.TestCase): self.assertEquals(resp.status_int, 204) def test_POST_update_meta(self): - """ Test swift.object_server.ObjectController.POST """ + # Test swift.obj.server.ObjectController.POST original_headers = self.object_controller.allowed_headers test_headers = 'content-encoding foo bar'.split() self.object_controller.allowed_headers = set(test_headers) @@ -348,7 +348,7 @@ class TestObjectController(unittest.TestCase): object_server.http_connect = old_http_connect def test_POST_quarantine_zbyte(self): - """ Test swift.object_server.ObjectController.GET """ + # Test swift.obj.server.ObjectController.GET timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -613,7 +613,7 @@ class TestObjectController(unittest.TestCase): object_server.http_connect = old_http_connect def test_HEAD(self): - """ Test swift.object_server.ObjectController.HEAD """ + # Test swift.obj.server.ObjectController.HEAD req = Request.blank('/sda1/p/a/c', environ={'REQUEST_METHOD': 'HEAD'}) resp = req.get_response(self.object_controller) self.assertEquals(resp.status_int, 400) @@ -678,7 +678,7 @@ class TestObjectController(unittest.TestCase): self.assertEquals(resp.status_int, 404) def test_HEAD_quarantine_zbyte(self): - """ Test swift.object_server.ObjectController.GET """ + # Test swift.obj.server.ObjectController.GET timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -706,7 +706,7 @@ class TestObjectController(unittest.TestCase): self.assertEquals(os.listdir(quar_dir)[0], file_name) def test_GET(self): - """ Test swift.object_server.ObjectController.GET """ + # Test swift.obj.server.ObjectController.GET req = Request.blank('/sda1/p/a/c', environ={'REQUEST_METHOD': 'GET'}) resp = req.get_response(self.object_controller) self.assertEquals(resp.status_int, 400) @@ -967,7 +967,7 @@ class TestObjectController(unittest.TestCase): self.assertEquals(resp.status_int, 200) def test_GET_quarantine(self): - """ Test swift.object_server.ObjectController.GET """ + # Test swift.obj.server.ObjectController.GET timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -998,7 +998,7 @@ class TestObjectController(unittest.TestCase): self.assertEquals(resp.status_int, 404) def test_GET_quarantine_zbyte(self): - """ Test swift.object_server.ObjectController.GET """ + # Test swift.obj.server.ObjectController.GET timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -1025,7 +1025,7 @@ class TestObjectController(unittest.TestCase): self.assertEquals(os.listdir(quar_dir)[0], file_name) def test_GET_quarantine_range(self): - """ Test swift.object_server.ObjectController.GET """ + # Test swift.obj.server.ObjectController.GET timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -1077,7 +1077,7 @@ class TestObjectController(unittest.TestCase): self.assertEquals(resp.status_int, 404) def test_DELETE(self): - # Test swift.object_server.ObjectController.DELETE + # Test swift.obj.server.ObjectController.DELETE req = Request.blank('/sda1/p/a/c', environ={'REQUEST_METHOD': 'DELETE'}) resp = req.get_response(self.object_controller) @@ -1157,7 +1157,7 @@ class TestObjectController(unittest.TestCase): self.assert_(os.path.isfile(objfile)) def test_DELETE_container_updates(self): - # Test swift.object_server.ObjectController.DELETE and container + # Test swift.obj.server.ObjectController.DELETE and container # updates, making sure container update is called in the correct # state. timestamp = normalize_timestamp(time()) @@ -1254,13 +1254,13 @@ class TestObjectController(unittest.TestCase): self.object_controller.container_update = orig_cu def test_call(self): - """ Test swift.object_server.ObjectController.__call__ """ + # Test swift.obj.server.ObjectController.__call__ inbuf = StringIO() errbuf = StringIO() outbuf = StringIO() def start_response(*args): - """ Sends args to outbuf """ + """Sends args to outbuf""" outbuf.writelines(args) self.object_controller.__call__({'REQUEST_METHOD': 'PUT', @@ -2623,10 +2623,7 @@ class TestObjectController(unittest.TestCase): diskfile.fallocate = orig_fallocate def test_serv_reserv(self): - """ - Test replication_server flag - was set from configuration file. - """ + # Test replication_server flag was set from configuration file. conf = {'devices': self.testdir, 'mount_check': 'false'} self.assertEquals( object_server.ObjectController(conf).replication_server, None) @@ -2640,7 +2637,7 @@ class TestObjectController(unittest.TestCase): object_server.ObjectController(conf).replication_server) def test_list_allowed_methods(self): - """ Test list of allowed_methods """ + # Test list of allowed_methods obj_methods = ['DELETE', 'PUT', 'HEAD', 'GET', 'POST'] repl_methods = ['REPLICATE'] for method_name in obj_methods: @@ -2651,10 +2648,8 @@ class TestObjectController(unittest.TestCase): self.assertEquals(method.replication, True) def test_correct_allowed_method(self): - """ - Test correct work for allowed method using - swift.object_server.ObjectController.__call__ - """ + # Test correct work for allowed method using + # swift.obj.server.ObjectController.__call__ inbuf = StringIO() errbuf = StringIO() outbuf = StringIO() @@ -2663,7 +2658,7 @@ class TestObjectController(unittest.TestCase): 'replication_server': 'false'}) def start_response(*args): - """ Sends args to outbuf """ + # Sends args to outbuf outbuf.writelines(args) method = 'PUT' @@ -2690,10 +2685,8 @@ class TestObjectController(unittest.TestCase): self.assertEqual(response, method_res) def test_not_allowed_method(self): - """ - Test correct work for NOT allowed method using - swift.object_server.ObjectController.__call__ - """ + # Test correct work for NOT allowed method using + # swift.obj.server.ObjectController.__call__ inbuf = StringIO() errbuf = StringIO() outbuf = StringIO() @@ -2702,7 +2695,7 @@ class TestObjectController(unittest.TestCase): 'replication_server': 'false'}) def start_response(*args): - """ Sends args to outbuf """ + # Sends args to outbuf outbuf.writelines(args) method = 'PUT'