Enable E128 ignore E129
After bumping the hacking version to the 0.9.x series ignores were
added for several rules. This commit fixes the violations for a subset
of these rules and re-enables the checks.
Change-Id: Iaff25fc9e2ecfad0c0574b39ddce0c5188d6c31f
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index c2376c9..3485943 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -145,7 +145,7 @@
self.assertEqual(200, resp.status)
self.assertIn((aggregate_id, new_aggregate_name, new_az_name),
map(lambda x:
- (x['id'], x['name'], x['availability_zone']),
+ (x['id'], x['name'], x['availability_zone']),
aggregates))
@test.attr(type='gate')
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index fb8ded3..3fa4a89 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -62,9 +62,9 @@
name = data_utils.rand_name('image')
resp, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
image_id = body['id']
image_file = StringIO.StringIO(('*' * 1024))
resp, body = cls.glance_client.update_image(image_id, data=image_file)
diff --git a/tempest/api/compute/v3/admin/test_aggregates.py b/tempest/api/compute/v3/admin/test_aggregates.py
index e5ec08b..886b6a7 100644
--- a/tempest/api/compute/v3/admin/test_aggregates.py
+++ b/tempest/api/compute/v3/admin/test_aggregates.py
@@ -135,7 +135,7 @@
self.assertEqual(200, resp.status)
self.assertIn((aggregate_id, new_aggregate_name, new_az_name),
map(lambda x:
- (x['id'], x['name'], x['availability_zone']),
+ (x['id'], x['name'], x['availability_zone']),
aggregates))
@test.attr(type='gate')
diff --git a/tempest/api/network/test_allowed_address_pair.py b/tempest/api/network/test_allowed_address_pair.py
index c897716..8d984d1 100644
--- a/tempest/api/network/test_allowed_address_pair.py
+++ b/tempest/api/network/test_allowed_address_pair.py
@@ -85,8 +85,8 @@
# Update allowed address pair attribute of port
allowed_address_pairs = [{'ip_address': self.ip_address,
'mac_address': self.mac_address}]
- resp, body = self.client.update_port(port_id,
- allowed_address_pairs=allowed_address_pairs)
+ resp, body = self.client.update_port(
+ port_id, allowed_address_pairs=allowed_address_pairs)
self.assertEqual('200', resp['status'])
newport = body['port']
self._confirm_allowed_address_pair(newport, self.ip_address)
diff --git a/tempest/api/network/test_load_balancer.py b/tempest/api/network/test_load_balancer.py
index db24e0d..7a12ef6 100644
--- a/tempest/api/network/test_load_balancer.py
+++ b/tempest/api/network/test_load_balancer.py
@@ -290,8 +290,8 @@
health_monitor = body['health_monitor']
# Verification of health_monitor update
resp, body = (self.client.update_health_monitor
- (health_monitor['id'],
- admin_state_up=False))
+ (health_monitor['id'],
+ admin_state_up=False))
self.assertEqual('200', resp['status'])
updated_health_monitor = body['health_monitor']
self.assertFalse(updated_health_monitor['admin_state_up'])
@@ -323,10 +323,10 @@
self.addCleanup(self.client.delete_health_monitor,
health_monitor['id'])
resp, body = (self.client.update_health_monitor
- (health_monitor['id'],
- http_method="POST",
- url_path="/home/user",
- expected_codes="290"))
+ (health_monitor['id'],
+ http_method="POST",
+ url_path="/home/user",
+ expected_codes="290"))
self.assertEqual('200', resp['status'])
updated_health_monitor = body['health_monitor']
self.assertEqual("POST", updated_health_monitor['http_method'])
@@ -348,7 +348,7 @@
def test_associate_disassociate_health_monitor_with_pool(self):
# Verify that a health monitor can be associated with a pool
resp, body = (self.client.associate_health_monitor_with_pool
- (self.health_monitor['id'], self.pool['id']))
+ (self.health_monitor['id'], self.pool['id']))
self.assertEqual('201', resp['status'])
resp, body = self.client.show_health_monitor(
self.health_monitor['id'])
@@ -360,7 +360,7 @@
self.assertIn(health_monitor['id'], pool['health_monitors'])
# Verify that a health monitor can be disassociated from a pool
resp, body = (self.client.disassociate_health_monitor_with_pool
- (self.health_monitor['id'], self.pool['id']))
+ (self.health_monitor['id'], self.pool['id']))
self.assertEqual('204', resp['status'])
resp, body = self.client.show_pool(self.pool['id'])
pool = body['pool']
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index dca4c17..878335d 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -115,11 +115,11 @@
def test_create_router_with_default_snat_value(self):
# Create a router with default snat rule
name = data_utils.rand_name('router')
- router = self._create_router(name,
- external_network_id=CONF.network.public_network_id)
- self._verify_router_gateway(router['id'],
- {'network_id': CONF.network.public_network_id,
- 'enable_snat': True})
+ router = self._create_router(
+ name, external_network_id=CONF.network.public_network_id)
+ self._verify_router_gateway(
+ router['id'], {'network_id': CONF.network.public_network_id,
+ 'enable_snat': True})
@test.requires_ext(extension='ext-gw-mode', service='network')
@test.attr(type='smoke')
@@ -135,10 +135,10 @@
name, external_gateway_info=external_gateway_info)
self.assertEqual('201', resp['status'])
self.addCleanup(self.admin_client.delete_router,
- create_body['router']['id'])
+ create_body['router']['id'])
# Verify snat attributes after router creation
self._verify_router_gateway(create_body['router']['id'],
- exp_ext_gw_info=external_gateway_info)
+ exp_ext_gw_info=external_gateway_info)
@test.attr(type='smoke')
def test_add_remove_router_interface_with_subnet_id(self):
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index d401f6b..6761a69 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -249,8 +249,8 @@
if return_code is 0:
break
self.assertNotEqual(count, 59,
- "Server %s is not pingable at %s" % (
- server['name'], addr))
+ "Server %s is not pingable at %s" % (
+ server['name'], addr))
def check_volumes(self):
"""Check that the volumes are still there and attached."""
@@ -401,7 +401,7 @@
image_id = _get_image_by_name(client, server['image'])['id']
flavor_id = _get_flavor_by_name(client, server['flavor'])['id']
resp, body = client.servers.create_server(server['name'], image_id,
- flavor_id)
+ flavor_id)
server_id = body['id']
client.servers.wait_for_server_status(server_id, 'ACTIVE')
@@ -420,7 +420,7 @@
client.servers.delete_server(response['id'])
client.servers.wait_for_server_termination(response['id'],
- ignore_error=True)
+ ignore_error=True)
#######################
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 4fce2cb..ff92b67 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -209,8 +209,9 @@
pattern = """Unexpected http success status code {0},
The expected status code is {1}"""
if ((not isinstance(expected_code, list) and
- (read_code != expected_code)) or (isinstance(expected_code,
- list) and (read_code not in expected_code))):
+ (read_code != expected_code)) or
+ (isinstance(expected_code, list) and
+ (read_code not in expected_code))):
details = pattern.format(read_code, expected_code)
raise exceptions.InvalidHttpSuccessCode(details)
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index d242c14..c4f1214 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -74,7 +74,7 @@
if (server_status == 'ERROR') and raise_on_error:
if 'fault' in body:
raise exceptions.BuildErrorException(body['fault'],
- server_id=server_id)
+ server_id=server_id)
else:
raise exceptions.BuildErrorException(server_id=server_id)
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 9d443cc..cc31fad 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -223,5 +223,8 @@
def __str__(self):
return ("Command '%s' returned non-zero exit status %d.\n"
- "stdout:\n%s\n"
- "stderr:\n%s" % (self.cmd, self.returncode, self.stdout, self.stderr))
+ "stdout:\n%s\n"
+ "stderr:\n%s" % (self.cmd,
+ self.returncode,
+ self.stdout,
+ self.stderr))
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 8e53b8d..2e28bfe 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -110,7 +110,7 @@
def add_router_interface_with_subnet_id(self, router_id, subnet_id):
uri = '%s/routers/%s/add_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
update_body = {"subnet_id": subnet_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
@@ -119,7 +119,7 @@
def add_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/add_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
update_body = {"port_id": port_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
@@ -128,7 +128,7 @@
def remove_router_interface_with_subnet_id(self, router_id, subnet_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
update_body = {"subnet_id": subnet_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
@@ -137,7 +137,7 @@
def remove_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
update_body = {"port_id": port_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
diff --git a/tempest/services/network/xml/network_client.py b/tempest/services/network/xml/network_client.py
index 8eb6362..ea9dc77 100644
--- a/tempest/services/network/xml/network_client.py
+++ b/tempest/services/network/xml/network_client.py
@@ -137,7 +137,7 @@
def add_router_interface_with_subnet_id(self, router_id, subnet_id):
uri = '%s/routers/%s/add_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
subnet = common.Element("subnet_id", subnet_id)
resp, body = self.put(uri, str(common.Document(subnet)))
body = _root_tag_fetcher_and_xml_to_json_parse(body)
@@ -145,7 +145,7 @@
def add_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/add_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
port = common.Element("port_id", port_id)
resp, body = self.put(uri, str(common.Document(port)))
body = _root_tag_fetcher_and_xml_to_json_parse(body)
@@ -153,7 +153,7 @@
def remove_router_interface_with_subnet_id(self, router_id, subnet_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
subnet = common.Element("subnet_id", subnet_id)
resp, body = self.put(uri, str(common.Document(subnet)))
body = _root_tag_fetcher_and_xml_to_json_parse(body)
@@ -161,7 +161,7 @@
def remove_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
- router_id)
+ router_id)
port = common.Element("port_id", port_id)
resp, body = self.put(uri, str(common.Document(port)))
body = _root_tag_fetcher_and_xml_to_json_parse(body)
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index b438f52..e0238d3 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -48,7 +48,7 @@
# Step 3: attach volume to vm
self.logger.info("attach volume (%s) to vm %s" %
- (volume['id'], server_id))
+ (volume['id'], server_id))
resp, body = self.manager.servers_client.attach_volume(server_id,
volume['id'],
'/dev/vdc')
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index a3ca0b7..0d3cb23 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -192,7 +192,7 @@
self._create_volume()
servers_client = self.manager.servers_client
self.logger.info("attach volume (%s) to vm %s" %
- (self.volume['id'], self.server_id))
+ (self.volume['id'], self.server_id))
resp, body = servers_client.attach_volume(self.server_id,
self.volume['id'],
self.part_name)
diff --git a/tempest/tests/negative/test_negative_auto_test.py b/tempest/tests/negative/test_negative_auto_test.py
index 7a1909a..9ef9733 100644
--- a/tempest/tests/negative/test_negative_auto_test.py
+++ b/tempest/tests/negative/test_negative_auto_test.py
@@ -30,9 +30,9 @@
"http-method": "GET",
"url": "flavors/detail",
"json-schema": {"type": "object",
- "properties":
- {"minRam": {"type": "integer"},
- "minDisk": {"type": "integer"}}
+ "properties":
+ {"minRam": {"type": "integer"},
+ "minDisk": {"type": "integer"}}
},
"resources": ["flavor", "volume", "image"]
}
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index 47ba982..9a6c9de 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -42,17 +42,17 @@
self.fake_auth.base_url = mock.MagicMock(return_value=self.endpoint)
- self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
- 'request',
- side_effect=self.fake_http.request(self.endpoint)[1]))
+ self.useFixture(mockpatch.PatchObject(
+ httplib.HTTPConnection,
+ 'request',
+ side_effect=self.fake_http.request(self.endpoint)[1]))
self.client = glance_http.HTTPClient(self.fake_auth, {})
def _set_response_fixture(self, header, status, resp_body):
resp = fake_http.fake_httplib(header, status=status,
body=six.StringIO(resp_body))
self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
- 'getresponse',
- return_value=resp))
+ 'getresponse', return_value=resp))
return resp
def test_json_request_without_content_type_header_in_response(self):
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 9fd8b45..4bf71f3 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -187,7 +187,7 @@
if len(args):
string += ", "
string += ", ".join("=".join(map(str, (key, value)))
- for (key, value) in kwargs.items())
+ for (key, value) in kwargs.items())
return string + ")"
@@ -592,83 +592,83 @@
for code in (('AccessDenied', 403),
- ('AccountProblem', 403),
- ('AmbiguousGrantByEmailAddress', 400),
- ('BadDigest', 400),
- ('BucketAlreadyExists', 409),
- ('BucketAlreadyOwnedByYou', 409),
- ('BucketNotEmpty', 409),
- ('CredentialsNotSupported', 400),
- ('CrossLocationLoggingProhibited', 403),
- ('EntityTooSmall', 400),
- ('EntityTooLarge', 400),
- ('ExpiredToken', 400),
- ('IllegalVersioningConfigurationException', 400),
- ('IncompleteBody', 400),
- ('IncorrectNumberOfFilesInPostRequest', 400),
- ('InlineDataTooLarge', 400),
- ('InvalidAccessKeyId', 403),
+ ('AccountProblem', 403),
+ ('AmbiguousGrantByEmailAddress', 400),
+ ('BadDigest', 400),
+ ('BucketAlreadyExists', 409),
+ ('BucketAlreadyOwnedByYou', 409),
+ ('BucketNotEmpty', 409),
+ ('CredentialsNotSupported', 400),
+ ('CrossLocationLoggingProhibited', 403),
+ ('EntityTooSmall', 400),
+ ('EntityTooLarge', 400),
+ ('ExpiredToken', 400),
+ ('IllegalVersioningConfigurationException', 400),
+ ('IncompleteBody', 400),
+ ('IncorrectNumberOfFilesInPostRequest', 400),
+ ('InlineDataTooLarge', 400),
+ ('InvalidAccessKeyId', 403),
'InvalidAddressingHeader',
- ('InvalidArgument', 400),
- ('InvalidBucketName', 400),
- ('InvalidBucketState', 409),
- ('InvalidDigest', 400),
- ('InvalidLocationConstraint', 400),
- ('InvalidPart', 400),
- ('InvalidPartOrder', 400),
- ('InvalidPayer', 403),
- ('InvalidPolicyDocument', 400),
- ('InvalidRange', 416),
- ('InvalidRequest', 400),
- ('InvalidSecurity', 403),
- ('InvalidSOAPRequest', 400),
- ('InvalidStorageClass', 400),
- ('InvalidTargetBucketForLogging', 400),
- ('InvalidToken', 400),
- ('InvalidURI', 400),
- ('KeyTooLong', 400),
- ('MalformedACLError', 400),
- ('MalformedPOSTRequest', 400),
- ('MalformedXML', 400),
- ('MaxMessageLengthExceeded', 400),
- ('MaxPostPreDataLengthExceededError', 400),
- ('MetadataTooLarge', 400),
- ('MethodNotAllowed', 405),
- ('MissingAttachment'),
- ('MissingContentLength', 411),
- ('MissingRequestBodyError', 400),
- ('MissingSecurityElement', 400),
- ('MissingSecurityHeader', 400),
- ('NoLoggingStatusForKey', 400),
- ('NoSuchBucket', 404),
- ('NoSuchKey', 404),
- ('NoSuchLifecycleConfiguration', 404),
- ('NoSuchUpload', 404),
- ('NoSuchVersion', 404),
- ('NotSignedUp', 403),
- ('NotSuchBucketPolicy', 404),
- ('OperationAborted', 409),
- ('PermanentRedirect', 301),
- ('PreconditionFailed', 412),
- ('Redirect', 307),
- ('RequestIsNotMultiPartContent', 400),
- ('RequestTimeout', 400),
- ('RequestTimeTooSkewed', 403),
- ('RequestTorrentOfBucketError', 400),
- ('SignatureDoesNotMatch', 403),
- ('TemporaryRedirect', 307),
- ('TokenRefreshRequired', 400),
- ('TooManyBuckets', 400),
- ('UnexpectedContent', 400),
- ('UnresolvableGrantByEmailAddress', 400),
- ('UserKeyMustBeSpecified', 400)):
+ ('InvalidArgument', 400),
+ ('InvalidBucketName', 400),
+ ('InvalidBucketState', 409),
+ ('InvalidDigest', 400),
+ ('InvalidLocationConstraint', 400),
+ ('InvalidPart', 400),
+ ('InvalidPartOrder', 400),
+ ('InvalidPayer', 403),
+ ('InvalidPolicyDocument', 400),
+ ('InvalidRange', 416),
+ ('InvalidRequest', 400),
+ ('InvalidSecurity', 403),
+ ('InvalidSOAPRequest', 400),
+ ('InvalidStorageClass', 400),
+ ('InvalidTargetBucketForLogging', 400),
+ ('InvalidToken', 400),
+ ('InvalidURI', 400),
+ ('KeyTooLong', 400),
+ ('MalformedACLError', 400),
+ ('MalformedPOSTRequest', 400),
+ ('MalformedXML', 400),
+ ('MaxMessageLengthExceeded', 400),
+ ('MaxPostPreDataLengthExceededError', 400),
+ ('MetadataTooLarge', 400),
+ ('MethodNotAllowed', 405),
+ ('MissingAttachment'),
+ ('MissingContentLength', 411),
+ ('MissingRequestBodyError', 400),
+ ('MissingSecurityElement', 400),
+ ('MissingSecurityHeader', 400),
+ ('NoLoggingStatusForKey', 400),
+ ('NoSuchBucket', 404),
+ ('NoSuchKey', 404),
+ ('NoSuchLifecycleConfiguration', 404),
+ ('NoSuchUpload', 404),
+ ('NoSuchVersion', 404),
+ ('NotSignedUp', 403),
+ ('NotSuchBucketPolicy', 404),
+ ('OperationAborted', 409),
+ ('PermanentRedirect', 301),
+ ('PreconditionFailed', 412),
+ ('Redirect', 307),
+ ('RequestIsNotMultiPartContent', 400),
+ ('RequestTimeout', 400),
+ ('RequestTimeTooSkewed', 403),
+ ('RequestTorrentOfBucketError', 400),
+ ('SignatureDoesNotMatch', 403),
+ ('TemporaryRedirect', 307),
+ ('TokenRefreshRequired', 400),
+ ('TooManyBuckets', 400),
+ ('UnexpectedContent', 400),
+ ('UnresolvableGrantByEmailAddress', 400),
+ ('UserKeyMustBeSpecified', 400)):
_add_matcher_class(BotoTestCase.s3_error_code.client,
code, base=ClientError)
for code in (('InternalError', 500),
- ('NotImplemented', 501),
- ('ServiceUnavailable', 503),
- ('SlowDown', 503)):
+ ('NotImplemented', 501),
+ ('ServiceUnavailable', 503),
+ ('SlowDown', 503)):
_add_matcher_class(BotoTestCase.s3_error_code.server,
code, base=ServerError)
diff --git a/tox.ini b/tox.ini
index 88a8cfa..b3d4397 100644
--- a/tox.ini
+++ b/tox.ini
@@ -110,7 +110,8 @@
# E125 is a won't fix until https://github.com/jcrocholl/pep8/issues/126 is resolved. For further detail see https://review.openstack.org/#/c/36788/
# H402 skipped because some docstrings aren't sentences
# E123 skipped because it is ignored by default in the default pep8
-# Skipped because of new hacking 0.9: H405,H904,E129,E128
-ignore = E125,H402,E123,H404,H405,H904,E129,E128
+# E129 skipped because it is too limiting when combined with other rules
+# Skipped because of new hacking 0.9: H405,H904
+ignore = E125,H402,E123,E129,H404,H405,H904
show-source = True
exclude = .git,.venv,.tox,dist,doc,openstack,*egg