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
This commit is contained in:
Matthew Treinish 2014-06-17 20:25:40 -04:00
parent 96e9e88dc0
commit 1d14c54fd8
18 changed files with 129 additions and 124 deletions

View File

@ -85,8 +85,8 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
# Update allowed address pair attribute of port # Update allowed address pair attribute of port
allowed_address_pairs = [{'ip_address': self.ip_address, allowed_address_pairs = [{'ip_address': self.ip_address,
'mac_address': self.mac_address}] 'mac_address': self.mac_address}]
resp, body = self.client.update_port(port_id, resp, body = self.client.update_port(
allowed_address_pairs=allowed_address_pairs) port_id, allowed_address_pairs=allowed_address_pairs)
self.assertEqual('200', resp['status']) self.assertEqual('200', resp['status'])
newport = body['port'] newport = body['port']
self._confirm_allowed_address_pair(newport, self.ip_address) self._confirm_allowed_address_pair(newport, self.ip_address)

View File

@ -115,10 +115,10 @@ class RoutersTest(base.BaseRouterTest):
def test_create_router_with_default_snat_value(self): def test_create_router_with_default_snat_value(self):
# Create a router with default snat rule # Create a router with default snat rule
name = data_utils.rand_name('router') name = data_utils.rand_name('router')
router = self._create_router(name, router = self._create_router(
external_network_id=CONF.network.public_network_id) name, external_network_id=CONF.network.public_network_id)
self._verify_router_gateway(router['id'], self._verify_router_gateway(
{'network_id': CONF.network.public_network_id, router['id'], {'network_id': CONF.network.public_network_id,
'enable_snat': True}) 'enable_snat': True})
@test.requires_ext(extension='ext-gw-mode', service='network') @test.requires_ext(extension='ext-gw-mode', service='network')

View File

@ -209,8 +209,9 @@ class RestClient(object):
pattern = """Unexpected http success status code {0}, pattern = """Unexpected http success status code {0},
The expected status code is {1}""" The expected status code is {1}"""
if ((not isinstance(expected_code, list) and if ((not isinstance(expected_code, list) and
(read_code != expected_code)) or (isinstance(expected_code, (read_code != expected_code)) or
list) and (read_code not in expected_code))): (isinstance(expected_code, list) and
(read_code not in expected_code))):
details = pattern.format(read_code, expected_code) details = pattern.format(read_code, expected_code)
raise exceptions.InvalidHttpSuccessCode(details) raise exceptions.InvalidHttpSuccessCode(details)

View File

@ -224,4 +224,7 @@ class CommandFailed(Exception):
def __str__(self): def __str__(self):
return ("Command '%s' returned non-zero exit status %d.\n" return ("Command '%s' returned non-zero exit status %d.\n"
"stdout:\n%s\n" "stdout:\n%s\n"
"stderr:\n%s" % (self.cmd, self.returncode, self.stdout, self.stderr)) "stderr:\n%s" % (self.cmd,
self.returncode,
self.stdout,
self.stderr))

View File

@ -42,7 +42,8 @@ class TestGlanceHTTPClient(base.TestCase):
self.fake_auth.base_url = mock.MagicMock(return_value=self.endpoint) self.fake_auth.base_url = mock.MagicMock(return_value=self.endpoint)
self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection, self.useFixture(mockpatch.PatchObject(
httplib.HTTPConnection,
'request', 'request',
side_effect=self.fake_http.request(self.endpoint)[1])) side_effect=self.fake_http.request(self.endpoint)[1]))
self.client = glance_http.HTTPClient(self.fake_auth, {}) self.client = glance_http.HTTPClient(self.fake_auth, {})
@ -51,8 +52,7 @@ class TestGlanceHTTPClient(base.TestCase):
resp = fake_http.fake_httplib(header, status=status, resp = fake_http.fake_httplib(header, status=status,
body=six.StringIO(resp_body)) body=six.StringIO(resp_body))
self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection, self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
'getresponse', 'getresponse', return_value=resp))
return_value=resp))
return resp return resp
def test_json_request_without_content_type_header_in_response(self): def test_json_request_without_content_type_header_in_response(self):

View File

@ -110,7 +110,8 @@ import_exceptions = tempest.services
# 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/ # 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 # H402 skipped because some docstrings aren't sentences
# E123 skipped because it is ignored by default in the default pep8 # E123 skipped because it is ignored by default in the default pep8
# Skipped because of new hacking 0.9: H405,H904,E129,E128 # E129 skipped because it is too limiting when combined with other rules
ignore = E125,H402,E123,H404,H405,H904,E129,E128 # Skipped because of new hacking 0.9: H405,H904
ignore = E125,H402,E123,E129,H404,H405,H904
show-source = True show-source = True
exclude = .git,.venv,.tox,dist,doc,openstack,*egg exclude = .git,.venv,.tox,dist,doc,openstack,*egg