PEP8. E125, F811, F401, H703
Change-Id: I9537e364affe20b9edf6861dc9a0d6437a112d30 Implements: blueprint reduce-amount-of-pep8-ignored-rules-in-tox-tests
This commit is contained in:
parent
52506396dd
commit
3333dd73e6
@ -129,8 +129,8 @@ if __name__ == "__main__":
|
||||
from trove.tests.api import limits
|
||||
from trove.tests.api import flavors
|
||||
from trove.tests.api import versions
|
||||
from trove.tests.api import instances
|
||||
from trove.tests.api import instances_actions
|
||||
from trove.tests.api import instances as rd_instances
|
||||
from trove.tests.api import instances_actions as rd_actions
|
||||
from trove.tests.api import instances_delete
|
||||
from trove.tests.api import instances_mysql_down
|
||||
from trove.tests.api import instances_resize
|
||||
@ -140,8 +140,8 @@ if __name__ == "__main__":
|
||||
from trove.tests.api import user_access
|
||||
from trove.tests.api.mgmt import accounts
|
||||
from trove.tests.api.mgmt import admin_required
|
||||
from trove.tests.api.mgmt import instances
|
||||
from trove.tests.api.mgmt import instances_actions
|
||||
from trove.tests.api.mgmt import instances as mgmt_instances
|
||||
from trove.tests.api.mgmt import instances_actions as mgmt_actions
|
||||
from trove.tests.api.mgmt import storage
|
||||
from trove.tests.api.mgmt import malformed_json
|
||||
except Exception as e:
|
||||
|
2
tox.ini
2
tox.ini
@ -33,7 +33,7 @@ commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
ignore = E125,F401,F403,F811,F821,H23,H301,H306,H401,H402,H403,H404,H702,H703
|
||||
ignore = F401,F403,F821,H301,H306,H401,H402,H403,H404,H702
|
||||
builtins = _
|
||||
exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools,etc,build
|
||||
filename=*.py,trove-*
|
@ -93,8 +93,8 @@ class InstanceDetailView(InstanceView):
|
||||
if ip is not None and len(ip) > 0:
|
||||
result['instance']['ip'] = ip
|
||||
|
||||
if isinstance(self.instance, models.DetailInstance) and \
|
||||
self.instance.volume_used:
|
||||
if (isinstance(self.instance, models.DetailInstance) and
|
||||
self.instance.volume_used):
|
||||
used = self.instance.volume_used
|
||||
if CONF.trove_volume_support:
|
||||
result['instance']['volume']['used'] = used
|
||||
|
@ -375,10 +375,10 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
|
||||
mapping = "%s:%s:%s:%s" % (v_ref.id, '', v_ref.size, 1)
|
||||
bdm = CONF.block_device_mapping
|
||||
block_device = {bdm: mapping}
|
||||
volumes = [{'id': v_ref.id,
|
||||
'size': v_ref.size}]
|
||||
created_volumes = [{'id': v_ref.id,
|
||||
'size': v_ref.size}]
|
||||
LOG.debug("block_device = %s" % block_device)
|
||||
LOG.debug("volume = %s" % volumes)
|
||||
LOG.debug("volume = %s" % created_volumes)
|
||||
|
||||
device_path = CONF.device_path
|
||||
mount_point = CONF.mount_point
|
||||
@ -388,7 +388,7 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
|
||||
volume_info = {'block_device': block_device,
|
||||
'device_path': device_path,
|
||||
'mount_point': mount_point,
|
||||
'volumes': volumes}
|
||||
'volumes': created_volumes}
|
||||
return volume_info
|
||||
|
||||
def _create_server(self, flavor_id, image_id, security_groups,
|
||||
@ -444,10 +444,10 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
|
||||
if server.addresses != {}:
|
||||
return True
|
||||
elif (server.addresses == {} and
|
||||
server.status != InstanceStatus.ERROR):
|
||||
server.status != InstanceStatus.ERROR):
|
||||
return False
|
||||
elif (server.addresses == {} and
|
||||
server.status == InstanceStatus.ERROR):
|
||||
server.status == InstanceStatus.ERROR):
|
||||
LOG.error(_("Instance IP not available, "
|
||||
"instance (%(instance)s): "
|
||||
"server had status (%(status)s).") %
|
||||
@ -703,7 +703,7 @@ class BackupTasks(object):
|
||||
if name:
|
||||
LOG.info("Deleting file: %s/%s", cont, name)
|
||||
client.delete_object(cont, name)
|
||||
# Delete the manifest file
|
||||
# Delete the manifest file
|
||||
LOG.info("Deleting file: %s/%s", container, filename)
|
||||
client.delete_object(container, filename)
|
||||
|
||||
@ -793,8 +793,8 @@ class ResizeActionBase(ConfigurationMixin):
|
||||
|
||||
def _guest_is_awake(self):
|
||||
self.instance._refresh_compute_service_status()
|
||||
return self.instance.service_status !=\
|
||||
rd_instance.ServiceStatuses.PAUSED
|
||||
return (self.instance.service_status !=
|
||||
rd_instance.ServiceStatuses.PAUSED)
|
||||
|
||||
def _perform_nova_action(self):
|
||||
"""Calls Nova to resize or migrate an instance, and confirms."""
|
||||
|
@ -20,7 +20,6 @@ from nose.tools import assert_false
|
||||
from nose.tools import assert_true
|
||||
from troveclient import exceptions
|
||||
from troveclient.flavors import Flavor
|
||||
from troveclient.flavors import Flavors
|
||||
|
||||
from proboscis import before_class
|
||||
from proboscis import test
|
||||
|
@ -108,7 +108,7 @@ class TestInstanceController(TestCase):
|
||||
validator = jsonschema.Draft4Validator(schema)
|
||||
self.assertTrue(validator.is_valid(body))
|
||||
|
||||
def test_validate_create_complete_with_restore(self):
|
||||
def test_validate_create_complete_with_restore_error(self):
|
||||
body = self.instance
|
||||
backup_id_ref = "invalid-backup-id-ref"
|
||||
body['instance']['restorePoint'] = {
|
||||
|
@ -51,7 +51,6 @@ class DictMismatch(object):
|
||||
|
||||
|
||||
class DictMatches(object):
|
||||
|
||||
def __init__(self, d1, approx_equal=False, tolerance=0.001):
|
||||
self.d1 = d1
|
||||
self.approx_equal = approx_equal
|
||||
@ -121,7 +120,6 @@ class ListLengthMismatch(object):
|
||||
|
||||
|
||||
class DictListMatches(object):
|
||||
|
||||
def __init__(self, l1, approx_equal=False, tolerance=0.001):
|
||||
self.l1 = l1
|
||||
self.approx_equal = approx_equal
|
||||
@ -163,17 +161,16 @@ class SubDictMismatch(object):
|
||||
if self.keys:
|
||||
return "Keys between dictionaries did not match"
|
||||
else:
|
||||
return("Dictionaries do not match at %s. d1: %s d2: %s"
|
||||
% (self.key,
|
||||
self.super_value,
|
||||
self.sub_value))
|
||||
return ("Dictionaries do not match at %s. d1: %s d2: %s"
|
||||
% (self.key,
|
||||
self.super_value,
|
||||
self.sub_value))
|
||||
|
||||
def get_details(self):
|
||||
return {}
|
||||
|
||||
|
||||
class IsSubDictOf(object):
|
||||
|
||||
def __init__(self, super_dict):
|
||||
self.super_dict = super_dict
|
||||
|
||||
@ -199,7 +196,6 @@ class IsSubDictOf(object):
|
||||
|
||||
|
||||
class FunctionCallMatcher(object):
|
||||
|
||||
def __init__(self, expected_func_calls):
|
||||
self.expected_func_calls = expected_func_calls
|
||||
self.actual_func_calls = []
|
||||
@ -408,7 +404,7 @@ class XMLMatches(object):
|
||||
if len(expected) == 0 and len(actual) == 0:
|
||||
# No children, compare text values
|
||||
if ('DONTCARE' not in (expected.text, actual.text) and
|
||||
expected.text != actual.text):
|
||||
expected.text != actual.text):
|
||||
return XMLTextValueMismatch(state, expected.text,
|
||||
actual.text)
|
||||
else:
|
||||
@ -421,7 +417,7 @@ class XMLMatches(object):
|
||||
# allow for, say, arbitrary ordering of some
|
||||
# elements
|
||||
if (expected[expected_idx].tag in
|
||||
(etree.Comment, etree.ProcessingInstruction)):
|
||||
(etree.Comment, etree.ProcessingInstruction)):
|
||||
expected_idx += 1
|
||||
continue
|
||||
|
||||
@ -445,7 +441,7 @@ class XMLMatches(object):
|
||||
if expected_idx < len(expected):
|
||||
for node in expected[expected_idx:]:
|
||||
if (node.tag in
|
||||
(etree.Comment, etree.ProcessingInstruction)):
|
||||
(etree.Comment, etree.ProcessingInstruction)):
|
||||
continue
|
||||
|
||||
return XMLExpectedChild(state, node.tag, actual_idx)
|
||||
|
@ -148,7 +148,7 @@ class PexpectMySqlConnection(object):
|
||||
if len(result) == 0:
|
||||
end_line = "1 row in set"
|
||||
if (line.startswith("***************************") or
|
||||
line.startswith(end_line)):
|
||||
line.startswith(end_line)):
|
||||
if row is not None:
|
||||
result.append(row)
|
||||
row = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user