diff options
author | Dina Belova <dbelova@mirantis.com> | 2013-06-03 17:44:55 +0400 |
---|---|---|
committer | Dina Belova <dbelova@mirantis.com> | 2013-06-11 18:28:29 +0400 |
commit | 7119e29cb535426c587eaf2cfc2cfcd11a422df0 (patch) | |
tree | ee61f4db5c8ef559a9c50c5c501fb6c421f41fa0 /tests | |
parent | ebaa578351c9c6b47c2f28ef6d74451e1483036b (diff) | |
download | oslo-7119e29cb535426c587eaf2cfc2cfcd11a422df0.tar.gz oslo-7119e29cb535426c587eaf2cfc2cfcd11a422df0.tar.xz oslo-7119e29cb535426c587eaf2cfc2cfcd11a422df0.zip |
Enable hacking H404 test.
H404 - multi line docstring should start with a summary.
Change-Id: I2099e1ee81ff9657f7a07401b8e8f3327d03bdbd
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/rpc/matchmaker_common.py | 13 | ||||
-rw-r--r-- | tests/unit/rpc/test_common.py | 3 | ||||
-rw-r--r-- | tests/unit/rpc/test_matchmaker_redis.py | 21 | ||||
-rw-r--r-- | tests/unit/rpc/test_qpid.py | 12 | ||||
-rw-r--r-- | tests/unit/rpc/test_zmq.py | 12 | ||||
-rw-r--r-- | tests/unit/scheduler/fake_hosts.py | 3 | ||||
-rw-r--r-- | tests/unit/scheduler/test_base_filter.py | 39 | ||||
-rw-r--r-- | tests/unit/test_service.py | 4 | ||||
-rw-r--r-- | tests/utils.py | 3 |
9 files changed, 44 insertions, 66 deletions
diff --git a/tests/unit/rpc/matchmaker_common.py b/tests/unit/rpc/matchmaker_common.py index 154162d..490c329 100644 --- a/tests/unit/rpc/matchmaker_common.py +++ b/tests/unit/rpc/matchmaker_common.py @@ -50,20 +50,17 @@ class _MatchMakerTestCase(_MatchMakerDirectedTopicTestCase): class _MatchMakerDynRegTestCase(object): def test_registers_host(self): - """ - Registers a host, ensures it is registered. - """ + """Registers a host, ensures it is registered.""" self.driver.register(self.topic, self.hosts[0]) match = self.driver.queues(self.topic) self.assertEqual(match[0][1], self.hosts[0]) def test_unregister(self): - """ - Tests that hosts unregister cleanly. - Registers a host, ensures it is registered, - then unregisters and ensures is no - longer registered. + """Tests that hosts unregister cleanly. + + Registers a host, ensures it is registered, then unregisters and + ensures is no longer registered. """ # Can only unregister if registrations work. self.test_registers_host() diff --git a/tests/unit/rpc/test_common.py b/tests/unit/rpc/test_common.py index 73ca63b..471048c 100644 --- a/tests/unit/rpc/test_common.py +++ b/tests/unit/rpc/test_common.py @@ -144,7 +144,8 @@ class RpcCommonTestCase(test_utils.BaseTestCase): six.text_type(after_exc)) def test_deserialize_remote_exception_args_and_kwargs(self): - """ + """Test user exception deserialization. + Ensure a user defined exception will be supplied the correct args and kwargs while being deserialized. """ diff --git a/tests/unit/rpc/test_matchmaker_redis.py b/tests/unit/rpc/test_matchmaker_redis.py index a1eb0a0..446908a 100644 --- a/tests/unit/rpc/test_matchmaker_redis.py +++ b/tests/unit/rpc/test_matchmaker_redis.py @@ -95,20 +95,17 @@ class MatchMakerRedisHeartbeatTestCase(utils.BaseTestCase, self.driver.unregister(self.topic, host) def test_expires_set(self): - """ - Test that expirations are set. - """ + """Test that expirations are set.""" self.driver.register(self.topic, self.hosts[0]) ttl = self.driver.redis.ttl('.'.join((self.topic, self.hosts[0]))) self.assertTrue(ttl > -1) def test_expires_hosts(self): - """ - Tests that hosts expire. - Registers a host, ensures it is registered, - then waits for it to expire. Ensures is no - longer registered. + """Tests that hosts expire. + + Registers a host, ensures it is registered, then waits for it to + expire. Ensures is no longer registered. """ self.driver.register(self.topic, self.hosts[0]) @@ -122,9 +119,7 @@ class MatchMakerRedisHeartbeatTestCase(utils.BaseTestCase, self.assertEqual(ttl2, -1) def test_expired_hosts_removed(self): - """ - Test that expired hosts are removed from results. - """ + """Test that expired hosts are removed from results.""" self.test_expires_hosts() self.assertEqual(self.driver.queues(self.topic), []) @@ -132,9 +127,7 @@ class MatchMakerRedisHeartbeatTestCase(utils.BaseTestCase, class MatchMakerRedisTestCase(utils.BaseTestCase): """Generic tests that do not require a Redis server.""" def test_redis_import_exception(self): - """ - Try initializing an object without redis. - """ + """Try initializing an object without redis.""" matchmaker.redis = None self.assertRaises(ImportError, matchmaker.MatchMakerRedis) reload(matchmaker) diff --git a/tests/unit/rpc/test_qpid.py b/tests/unit/rpc/test_qpid.py index 02e8e20..42a6e6b 100644 --- a/tests/unit/rpc/test_qpid.py +++ b/tests/unit/rpc/test_qpid.py @@ -45,8 +45,7 @@ FLAGS = cfg.CONF class RpcQpidTestCase(utils.BaseTestCase): - """ - Exercise the public API of impl_qpid utilizing mox. + """Exercise the public API of impl_qpid utilizing mox. This set of tests utilizes mox to replace the Qpid objects and ensures that the right operations happen on them when the various public rpc API @@ -479,10 +478,11 @@ class RpcQpidTestCase(utils.BaseTestCase): impl_qpid.Connection.pool.get() def test_call_with_timeout(self): - """A little more indepth for a timeout test. Specifically we are - looking to simulate the event sent to qpid dying on the vine due - to a TTL. A string test that actually involved qpid would be - excellent, but this at least verifies that the exceptions flow + """A little more indepth for a timeout test. + + Specifically we are looking to simulate the event sent to qpid dying + on the vine due to a TTL. A string test that actually involved qpid + would be excellent, but this at least verifies that the exceptions flow like they should. TODO(beagles): is this really necessary or is the the case for qpid at least the basic timeout test is sufficient. diff --git a/tests/unit/rpc/test_zmq.py b/tests/unit/rpc/test_zmq.py index 564f15e..b0f0262 100644 --- a/tests/unit/rpc/test_zmq.py +++ b/tests/unit/rpc/test_zmq.py @@ -42,9 +42,7 @@ FLAGS = cfg.CONF def get_unused_port(): - """ - Returns an unused port on localhost. - """ + """Returns an unused port on localhost.""" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('localhost', 0)) addr, port = s.getsockname() @@ -117,7 +115,8 @@ class _RpcZmqBaseTestCase(common.BaseRpcTestCase): class RpcZmqBaseTopicTestCase(_RpcZmqBaseTestCase): - """ + """Base topic RPC ZMQ test case. + This tests with topics such as 'test' and 'nested', without any .host appended. Stresses the matchmaker. """ @@ -125,10 +124,7 @@ class RpcZmqBaseTopicTestCase(_RpcZmqBaseTestCase): class RpcZmqDirectTopicTestCase(_RpcZmqBaseTestCase): - """ - Test communication directly to a host, - tests use 'localhost'. - """ + """Test communication directly to a host, tests use 'localhost'.""" def setUp(self): super(RpcZmqDirectTopicTestCase, self).setUp( topic='test.127.0.0.1', diff --git a/tests/unit/scheduler/fake_hosts.py b/tests/unit/scheduler/fake_hosts.py index b02aca4..baaa148 100644 --- a/tests/unit/scheduler/fake_hosts.py +++ b/tests/unit/scheduler/fake_hosts.py @@ -18,7 +18,8 @@ Fakes For filters tests. class FakeHostManager(object): - """ + """Defines fake hosts. + host1: free_ram_mb=1024-512-512=0, free_disk_gb=1024-512-512=0 host2: free_ram_mb=2048-512=1536 free_disk_gb=2048-512=1536 host3: free_ram_mb=4096-1024=3072 free_disk_gb=4096-1024=3072 diff --git a/tests/unit/scheduler/test_base_filter.py b/tests/unit/scheduler/test_base_filter.py index d66d84c..3d7e345 100644 --- a/tests/unit/scheduler/test_base_filter.py +++ b/tests/unit/scheduler/test_base_filter.py @@ -51,49 +51,42 @@ class BaseFakeFilter(base_filter.BaseFilter): class FakeFilter1(BaseFakeFilter): - """ - * Should be included in the output of all_classes - * It derives from BaseFakeFilter - * AND - * It has a fake entry point defined (is returned by fake ExtensionManager) + """Derives from BaseFakeFilter and has a fake entry point defined. + + Entry point is returned by fake ExtensionManager. + Should be included in the output of all_classes. """ pass class FakeFilter2(BaseFakeFilter): - """ - * Should be NOT included in all_classes - * Derives from BaseFakeFilter - * BUT - * It has no entry point + """Derives from BaseFakeFilter but has no entry point. + + Should be not included in all_classes. """ pass class FakeFilter3(base_filter.BaseFilter): - """ - * Should NOT be included - * Does NOT derive from BaseFakeFilter + """Does not derive from BaseFakeFilter. + + Should not be included. """ pass class FakeFilter4(BaseFakeFilter): - """ - Should be included - * Derives from BaseFakeFilter - * AND - * It has an entrypoint + """Derives from BaseFakeFilter and has an entry point. + + Should be included. """ pass class FakeFilter5(BaseFakeFilter): - """ - Should NOT be included - * Derives from BaseFakeFilter - * BUT - * It has NO entrypoint + """Derives from BaseFakeFilter but has no entry point. + + Should not be included. """ pass diff --git a/tests/unit/test_service.py b/tests/unit/test_service.py index 4a2827e..7e07f28 100644 --- a/tests/unit/test_service.py +++ b/tests/unit/test_service.py @@ -62,9 +62,7 @@ class ServiceWithTimer(service.Service): class ServiceLauncherTest(utils.BaseTestCase): - """ - Originally from nova/tests/integrated/test_multiprocess_api.py - """ + """Originally from nova/tests/integrated/test_multiprocess_api.py.""" def _spawn(self): self.workers = 2 diff --git a/tests/utils.py b/tests/utils.py index 7d0cc85..794a3d2 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -66,8 +66,7 @@ class BaseTestCase(testtools.TestCase): return tempfiles def config(self, **kw): - """ - Override some configuration values. + """Override some configuration values. The keyword arguments are the names of configuration options to override and their values. |