diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-01-09 01:01:57 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-01-09 01:01:57 +0000 |
| commit | fa4696ff03260351e0755191e479fcc8026ab828 (patch) | |
| tree | 4c5586992894a3a81fea1be4916073d5d5ce2fdc /nova/tests | |
| parent | e15b65f45673971480a66d17ccb771d7b7a46a30 (diff) | |
| parent | 37bfdd3b38b2d2c2f088f67e7bcc2f26c6e01c1c (diff) | |
Merge "fix N401 errors, stop ignoring all N4* errors"
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/compute/test_servers.py | 9 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_common.py | 38 | ||||
| -rw-r--r-- | nova/tests/compute/test_compute.py | 6 | ||||
| -rw-r--r-- | nova/tests/integrated/test_api_samples.py | 2 | ||||
| -rw-r--r-- | nova/tests/monkey_patch_example/__init__.py | 2 | ||||
| -rw-r--r-- | nova/tests/test_api.py | 2 | ||||
| -rw-r--r-- | nova/tests/test_db_api.py | 4 | ||||
| -rw-r--r-- | nova/tests/test_libvirt.py | 10 | ||||
| -rw-r--r-- | nova/tests/test_xenapi.py | 2 | ||||
| -rw-r--r-- | nova/tests/xenapi/stubs.py | 10 |
10 files changed, 40 insertions, 45 deletions
diff --git a/nova/tests/api/openstack/compute/test_servers.py b/nova/tests/api/openstack/compute/test_servers.py index f916925fd..938783be7 100644 --- a/nova/tests/api/openstack/compute/test_servers.py +++ b/nova/tests/api/openstack/compute/test_servers.py @@ -1782,17 +1782,12 @@ class ServersControllerCreateTest(test.TestCase): fake_method) def _check_admin_pass_len(self, server_dict): - """ utility function - check server_dict for adminPass - length. - - """ + """utility function - check server_dict for adminPass length.""" self.assertEqual(CONF.password_length, len(server_dict["adminPass"])) def _check_admin_pass_missing(self, server_dict): - """ utility function - check server_dict for absence - of adminPass - """ + """utility function - check server_dict for absence of adminPass.""" self.assertTrue("adminPass" not in server_dict) def _test_create_instance(self): diff --git a/nova/tests/api/openstack/test_common.py b/nova/tests/api/openstack/test_common.py index 28bbb3d25..db1c9ede2 100644 --- a/nova/tests/api/openstack/test_common.py +++ b/nova/tests/api/openstack/test_common.py @@ -43,7 +43,7 @@ class LimiterTest(test.TestCase): """ def setUp(self): - """ Run before each test. """ + """Run before each test. """ super(LimiterTest, self).setUp() self.tiny = range(1) self.small = range(10) @@ -51,7 +51,7 @@ class LimiterTest(test.TestCase): self.large = range(10000) def test_limiter_offset_zero(self): - """ Test offset key works with 0. """ + """Test offset key works with 0. """ req = webob.Request.blank('/?offset=0') self.assertEqual(common.limited(self.tiny, req), self.tiny) self.assertEqual(common.limited(self.small, req), self.small) @@ -59,7 +59,7 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(self.large, req), self.large[:1000]) def test_limiter_offset_medium(self): - """ Test offset key works with a medium sized number. """ + """Test offset key works with a medium sized number. """ req = webob.Request.blank('/?offset=10') self.assertEqual(common.limited(self.tiny, req), []) self.assertEqual(common.limited(self.small, req), self.small[10:]) @@ -67,7 +67,7 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(self.large, req), self.large[10:1010]) def test_limiter_offset_over_max(self): - """ Test offset key works with a number over 1000 (max_limit). """ + """Test offset key works with a number over 1000 (max_limit). """ req = webob.Request.blank('/?offset=1001') self.assertEqual(common.limited(self.tiny, req), []) self.assertEqual(common.limited(self.small, req), []) @@ -76,19 +76,19 @@ class LimiterTest(test.TestCase): common.limited(self.large, req), self.large[1001:2001]) def test_limiter_offset_blank(self): - """ Test offset key works with a blank offset. """ + """Test offset key works with a blank offset. """ req = webob.Request.blank('/?offset=') self.assertRaises( webob.exc.HTTPBadRequest, common.limited, self.tiny, req) def test_limiter_offset_bad(self): - """ Test offset key works with a BAD offset. """ + """Test offset key works with a BAD offset. """ req = webob.Request.blank(u'/?offset=\u0020aa') self.assertRaises( webob.exc.HTTPBadRequest, common.limited, self.tiny, req) def test_limiter_nothing(self): - """ Test request with no offset or limit """ + """Test request with no offset or limit """ req = webob.Request.blank('/') self.assertEqual(common.limited(self.tiny, req), self.tiny) self.assertEqual(common.limited(self.small, req), self.small) @@ -96,7 +96,7 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(self.large, req), self.large[:1000]) def test_limiter_limit_zero(self): - """ Test limit of zero. """ + """Test limit of zero. """ req = webob.Request.blank('/?limit=0') self.assertEqual(common.limited(self.tiny, req), self.tiny) self.assertEqual(common.limited(self.small, req), self.small) @@ -104,7 +104,7 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(self.large, req), self.large[:1000]) def test_limiter_limit_medium(self): - """ Test limit of 10. """ + """Test limit of 10. """ req = webob.Request.blank('/?limit=10') self.assertEqual(common.limited(self.tiny, req), self.tiny) self.assertEqual(common.limited(self.small, req), self.small) @@ -112,7 +112,7 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(self.large, req), self.large[:10]) def test_limiter_limit_over_max(self): - """ Test limit of 3000. """ + """Test limit of 3000. """ req = webob.Request.blank('/?limit=3000') self.assertEqual(common.limited(self.tiny, req), self.tiny) self.assertEqual(common.limited(self.small, req), self.small) @@ -120,7 +120,7 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(self.large, req), self.large[:1000]) def test_limiter_limit_and_offset(self): - """ Test request with both limit and offset. """ + """Test request with both limit and offset. """ items = range(2000) req = webob.Request.blank('/?offset=1&limit=3') self.assertEqual(common.limited(items, req), items[1:4]) @@ -132,7 +132,7 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(items, req), []) def test_limiter_custom_max_limit(self): - """ Test a max_limit other than 1000. """ + """Test a max_limit other than 1000. """ items = range(2000) req = webob.Request.blank('/?offset=1&limit=3') self.assertEqual( @@ -147,13 +147,13 @@ class LimiterTest(test.TestCase): self.assertEqual(common.limited(items, req, max_limit=2000), []) def test_limiter_negative_limit(self): - """ Test a negative limit. """ + """Test a negative limit. """ req = webob.Request.blank('/?limit=-3000') self.assertRaises( webob.exc.HTTPBadRequest, common.limited, self.tiny, req) def test_limiter_negative_offset(self): - """ Test a negative offset. """ + """Test a negative offset. """ req = webob.Request.blank('/?offset=-30') self.assertRaises( webob.exc.HTTPBadRequest, common.limited, self.tiny, req) @@ -167,30 +167,30 @@ class PaginationParamsTest(test.TestCase): """ def test_no_params(self): - """ Test no params. """ + """Test no params. """ req = webob.Request.blank('/') self.assertEqual(common.get_pagination_params(req), {}) def test_valid_marker(self): - """ Test valid marker param. """ + """Test valid marker param. """ req = webob.Request.blank( '/?marker=263abb28-1de6-412f-b00b-f0ee0c4333c2') self.assertEqual(common.get_pagination_params(req), {'marker': '263abb28-1de6-412f-b00b-f0ee0c4333c2'}) def test_valid_limit(self): - """ Test valid limit param. """ + """Test valid limit param. """ req = webob.Request.blank('/?limit=10') self.assertEqual(common.get_pagination_params(req), {'limit': 10}) def test_invalid_limit(self): - """ Test invalid limit param. """ + """Test invalid limit param. """ req = webob.Request.blank('/?limit=-2') self.assertRaises( webob.exc.HTTPBadRequest, common.get_pagination_params, req) def test_valid_limit_and_marker(self): - """ Test valid limit and marker parameters. """ + """Test valid limit and marker parameters. """ marker = '263abb28-1de6-412f-b00b-f0ee0c4333c2' req = webob.Request.blank('/?limit=20&marker=%s' % marker) self.assertEqual(common.get_pagination_params(req), diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index dabb8bb89..9d8114ea2 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -573,7 +573,7 @@ class ComputeTestCase(BaseTestCase): 'task_state': task_states.SCHEDULING}) def test_run_instance_setup_block_device_mapping_fail(self): - """ block device mapping failure test. + """block device mapping failure test. Make sure that when there is a block device mapping problem, the instance goes to ERROR state, keeping the task state @@ -593,7 +593,7 @@ class ComputeTestCase(BaseTestCase): 'task_state': None}) def test_run_instance_spawn_fail(self): - """ spawn failure test. + """spawn failure test. Make sure that when there is a spawning problem, the instance goes to ERROR state, keeping the task state""" @@ -611,7 +611,7 @@ class ComputeTestCase(BaseTestCase): 'task_state': None}) def test_run_instance_dealloc_network_instance_not_found(self): - """ spawn network deallocate test. + """spawn network deallocate test. Make sure that when an instance is not found during spawn that the network is deallocated""" diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 8347f9bca..ef1f35a52 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -1533,7 +1533,7 @@ class AgentsJsonTest(ApiSampleTestBase): return project def test_agent_list(self): - """ Return a list of all agent builds.""" + """Return a list of all agent builds.""" response = self._do_get('os-agents') self.assertEqual(response.status, 200) project = {'url': 'xxxxxxxxxxxx', diff --git a/nova/tests/monkey_patch_example/__init__.py b/nova/tests/monkey_patch_example/__init__.py index 25cf9ccfe..779dc72f3 100644 --- a/nova/tests/monkey_patch_example/__init__.py +++ b/nova/tests/monkey_patch_example/__init__.py @@ -21,7 +21,7 @@ CALLED_FUNCTION = [] def example_decorator(name, function): - """ decorator for notify which is used from utils.monkey_patch() + """decorator for notify which is used from utils.monkey_patch() :param name: name of the function :param function: - object of the function diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py index 163afda7d..0835df51d 100644 --- a/nova/tests/test_api.py +++ b/nova/tests/test_api.py @@ -350,7 +350,7 @@ class ApiEc2TestCase(test.TestCase): self.ec2.delete_security_group(security_group_name) def test_group_name_valid_chars_security_group(self): - """ Test that we sanely handle invalid security group names. + """Test that we sanely handle invalid security group names. EC2 API Spec states we should only accept alphanumeric characters, spaces, dashes, and underscores. Amazon implementation accepts more characters - so, [:print:] is ok. """ diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index a17113a42..6ebfe6d3c 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -321,7 +321,7 @@ class DbApiTestCase(test.TestCase): inst['uuid'], 'vm_state', [None, 'disable'], 'run') def test_instance_update_with_instance_uuid(self): - """ test instance_update() works when an instance UUID is passed """ + """test instance_update() works when an instance UUID is passed """ ctxt = context.get_admin_context() # Create an instance with some metadata @@ -481,7 +481,7 @@ class DbApiTestCase(test.TestCase): self.assertEqual(404, faults[uuid][0]['code']) def test_instance_fault_get_by_instance(self): - """ ensure we can retrieve an instance fault by instance UUID """ + """ensure we can retrieve an instance fault by instance UUID """ ctxt = context.get_admin_context() instance1 = db.instance_create(ctxt, {}) instance2 = db.instance_create(ctxt, {}) diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 6bc18251f..a64b72695 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -4303,12 +4303,12 @@ class LibvirtDriverTestCase(test.TestCase): self.stubs.Set(utils, 'execute', fake_execute) ins_ref = self._create_instance() - """ dest is different host case """ + # dest is different host case out = self.libvirtconnection.migrate_disk_and_power_off( None, ins_ref, '10.0.0.2', None, None) self.assertEquals(out, disk_info_text) - """ dest is same host case """ + # dest is same host case out = self.libvirtconnection.migrate_disk_and_power_off( None, ins_ref, '10.0.0.1', None, None) self.assertEquals(out, disk_info_text) @@ -4325,19 +4325,19 @@ class LibvirtDriverTestCase(test.TestCase): self.stubs.Set(self.libvirtconnection, 'get_info', fake_get_info) - """ instance not found case """ + # instance not found case self.assertRaises(exception.NotFound, self.libvirtconnection._wait_for_running, {'name': 'not_found', 'uuid': 'not_found_uuid'}) - """ instance is running case """ + # instance is running case self.assertRaises(utils.LoopingCallDone, self.libvirtconnection._wait_for_running, {'name': 'running', 'uuid': 'running_uuid'}) - """ else case """ + # else case self.libvirtconnection._wait_for_running({'name': 'else', 'uuid': 'other_uuid'}) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 8b57dfef4..5b347fc0f 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -2509,7 +2509,7 @@ class StubDependencies(object): class ResourcePoolWithStubs(StubDependencies, pool.ResourcePool): - """ A ResourcePool, use stub dependencies """ + """A ResourcePool, use stub dependencies """ class HypervisorPoolTestCase(test.TestCase): diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index ca8281295..a44f3e9fd 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -98,7 +98,7 @@ def stubout_determine_is_pv_objectstore(stubs): def stubout_is_snapshot(stubs): - """ Always returns true + """Always returns true xenapi fake driver does not create vmrefs for snapshots """ def f(*args): @@ -158,7 +158,7 @@ def _make_fake_vdi(): class FakeSessionForVMTests(fake.SessionBase): - """ Stubs out a XenAPISession for VM tests """ + """Stubs out a XenAPISession for VM tests """ _fake_iptables_save_output = ("# Generated by iptables-save v1.4.10 on " "Sun Nov 6 22:49:02 2011\n" @@ -204,7 +204,7 @@ class FakeSessionForVMTests(fake.SessionBase): class FakeSessionForFirewallTests(FakeSessionForVMTests): - """ Stubs out a XenApi Session for doing IPTable Firewall tests """ + """Stubs out a XenApi Session for doing IPTable Firewall tests """ def __init__(self, uri, test_case=None): super(FakeSessionForFirewallTests, self).__init__(uri) @@ -270,7 +270,7 @@ def stub_out_vm_methods(stubs): class FakeSessionForVolumeTests(fake.SessionBase): - """ Stubs out a XenAPISession for Volume tests """ + """Stubs out a XenAPISession for Volume tests """ def VDI_introduce(self, _1, uuid, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11): valid_vdi = False @@ -284,7 +284,7 @@ class FakeSessionForVolumeTests(fake.SessionBase): class FakeSessionForVolumeFailedTests(FakeSessionForVolumeTests): - """ Stubs out a XenAPISession for Volume tests: it injects failures """ + """Stubs out a XenAPISession for Volume tests: it injects failures """ def VDI_introduce(self, _1, uuid, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11): # This is for testing failure |
