Bump hacking to 3.0.0
The new version enables a lot of standard flake8 checks, so a few
fixes are required. W503 is disabled as it conflicts with W504
and the latter seems to be preferred nowadays.
Change-Id: I3b1e20193a2cb3d28046ad0f2008577a95aaaefd
diff --git a/ironic_tempest_plugin/common/waiters.py b/ironic_tempest_plugin/common/waiters.py
index 554e5f8..c5b9bd0 100644
--- a/ironic_tempest_plugin/common/waiters.py
+++ b/ironic_tempest_plugin/common/waiters.py
@@ -28,9 +28,9 @@
timeout = default_timeout
if interval is None:
interval = default_interval
- if (not isinstance(timeout, six.integer_types) or
- not isinstance(interval, six.integer_types) or
- timeout < 0 or interval < 0):
+ if (not isinstance(timeout, six.integer_types)
+ or not isinstance(interval, six.integer_types)
+ or timeout < 0 or interval < 0):
raise AssertionError(
'timeout and interval should be >= 0 or None, current values are: '
'%(timeout)s, %(interval)s respectively. If timeout and/or '
diff --git a/ironic_tempest_plugin/services/baremetal/base.py b/ironic_tempest_plugin/services/baremetal/base.py
index 46c0a2f..3c52fcd 100644
--- a/ironic_tempest_plugin/services/baremetal/base.py
+++ b/ironic_tempest_plugin/services/baremetal/base.py
@@ -67,8 +67,9 @@
def request(self, *args, **kwargs):
resp, resp_body = super(BaremetalClient, self).request(*args, **kwargs)
- if (BAREMETAL_MICROVERSION and
- BAREMETAL_MICROVERSION != api_version_utils.LATEST_MICROVERSION):
+ latest_microversion = api_version_utils.LATEST_MICROVERSION
+ if (BAREMETAL_MICROVERSION
+ and BAREMETAL_MICROVERSION != latest_microversion):
api_version_utils.assert_version_header_matches_request(
self.api_microversion_header_name,
BAREMETAL_MICROVERSION,
diff --git a/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py b/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py
index 4f8bfe8..5be84cc 100644
--- a/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py
+++ b/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py
@@ -459,8 +459,8 @@
@classmethod
def skip_checks(cls):
super(BaremetalStandaloneScenarioTest, cls).skip_checks()
- if (cls.driver not in CONF.baremetal.enabled_drivers +
- CONF.baremetal.enabled_hardware_types):
+ if (cls.driver not in CONF.baremetal.enabled_drivers
+ + CONF.baremetal.enabled_hardware_types):
raise cls.skipException(
'The driver: %(driver)s used in test is not in the list of '
'enabled_drivers %(enabled_drivers)s or '
diff --git a/ironic_tempest_plugin/tests/scenario/introspection_manager.py b/ironic_tempest_plugin/tests/scenario/introspection_manager.py
index 0131089..3eb3f43 100644
--- a/ironic_tempest_plugin/tests/scenario/introspection_manager.py
+++ b/ironic_tempest_plugin/tests/scenario/introspection_manager.py
@@ -64,10 +64,10 @@
# microversion
self.useFixture(IronicMicroversionFixture(self.ironic_api_version))
self.flavor = self.baremetal_flavor()
- self.node_ids = {node['uuid'] for node in
- self.node_filter(filter=lambda node:
- node['provision_state'] ==
- BaremetalProvisionStates.AVAILABLE)}
+ self.node_ids = {
+ node['uuid'] for node in self.node_filter(
+ filter=lambda node:
+ node['provision_state'] == BaremetalProvisionStates.AVAILABLE)}
self.rule_purge()
def item_filter(self, list_method, show_method,
@@ -204,8 +204,8 @@
raise exceptions.IntrospectionFailed(message)
not_introspected = not_introspected - {node_id}
- if (int(time.time()) - start >=
- CONF.baremetal_introspection.introspection_timeout):
+ if (int(time.time()) - start
+ >= CONF.baremetal_introspection.introspection_timeout):
message = ('Introspection timed out for nodes: %s' %
not_introspected)
raise exceptions.IntrospectionTimeout(message)
@@ -228,8 +228,8 @@
raise exceptions.HypervisorUpdateTimeout(message)
def node_cleanup(self, node_id):
- if (self.node_show(node_id)['provision_state'] ==
- BaremetalProvisionStates.AVAILABLE):
+ if (self.node_show(node_id)['provision_state']
+ == BaremetalProvisionStates.AVAILABLE):
return
# in case when introspection failed we need set provision state
# to 'manage' to make it possible transit into 'provide' state
diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
index 92f41fd..33d8724 100644
--- a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
+++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
@@ -44,8 +44,8 @@
if not CONF.baremetal.use_provision_network:
msg = 'Ironic/Neutron tenant isolation is not configured.'
raise cls.skipException(msg)
- if (CONF.baremetal.available_nodes is not None and
- CONF.baremetal.available_nodes < 2):
+ if (CONF.baremetal.available_nodes is not None
+ and CONF.baremetal.available_nodes < 2):
msg = ('Not enough baremetal nodes, %d configured, test requires '
'a minimum of 2') % CONF.baremetal.available_nodes
raise cls.skipException(msg)
diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py
index 3715608..d935874 100644
--- a/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py
+++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py
@@ -44,8 +44,8 @@
if not CONF.baremetal.use_provision_network:
msg = 'Ironic/Neutron tenant isolation is not configured.'
raise cls.skipException(msg)
- if (CONF.baremetal.available_nodes is not None and
- CONF.baremetal.available_nodes < 2):
+ if (CONF.baremetal.available_nodes is not None
+ and CONF.baremetal.available_nodes < 2):
msg = ('Not enough baremetal nodes, %d configured, test requires '
'a minimum of 2') % CONF.baremetal.available_nodes
raise cls.skipException(msg)
diff --git a/ironic_tempest_plugin/tests/scenario/test_introspection_discovery.py b/ironic_tempest_plugin/tests/scenario/test_introspection_discovery.py
index 6f92d43..6ebfcc6 100644
--- a/ironic_tempest_plugin/tests/scenario/test_introspection_discovery.py
+++ b/ironic_tempest_plugin/tests/scenario/test_introspection_discovery.py
@@ -92,9 +92,9 @@
discovered_node = None
for node in nodes:
- if (node['provision_state'] == ProvisionStates.AVAILABLE or
- node['provision_state'] == ProvisionStates.ENROLL or
- node['provision_state'] is ProvisionStates.NOSTATE):
+ if (node['provision_state'] == ProvisionStates.AVAILABLE
+ or node['provision_state'] == ProvisionStates.ENROLL
+ or node['provision_state'] is ProvisionStates.NOSTATE):
discovered_node = node['uuid']
break