Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found by updated hacking version.
The tempest plugin is used on older branches as well.
We really only need hacking on master anyways,
where we no longer support python 2, so here we
make the requirement specific to python 3.
Change-Id: I885da1613e9cf754302700019a1207a279b3af2a
diff --git a/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby.py b/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby.py
index 612bbe2..5655b3f 100644
--- a/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby.py
+++ b/octavia_tempest_plugin/tests/act_stdby_scenario/v2/test_active_standby.py
@@ -270,7 +270,7 @@
connections = 0
for listener in amphora_stats:
connections += listener[const.TOTAL_CONNECTIONS]
- self.assertTrue(connections > 0)
+ self.assertGreater(connections, 0)
LOG.info('Backup amphora is now Master.')
# Wait for the amphora failover to start
waiters.wait_for_status(
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_amphora.py b/octavia_tempest_plugin/tests/scenario/v2/test_amphora.py
index 9101321..95266e8 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_amphora.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_amphora.py
@@ -96,8 +96,8 @@
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
amphora_client = self.os_roles_lb_admin.amphora_client
amphora_adm = amphora_client.list_amphorae()
- self.assertTrue(
- len(amphora_adm) >= 2 * self._expected_amp_count(amphora_adm))
+ self.assertGreaterEqual(
+ len(amphora_adm), 2 * self._expected_amp_count(amphora_adm))
# Test that a different user, with load balancer member role, cannot
# see this amphora
@@ -116,15 +116,16 @@
# Test that a user with cloud admin role can list the amphorae
if not CONF.load_balancer.RBAC_test_type == const.NONE:
adm = self.lb_admin_amphora_client.list_amphorae()
- self.assertTrue(len(adm) >= 2 * self._expected_amp_count(adm))
+ self.assertGreaterEqual(len(adm),
+ 2 * self._expected_amp_count(adm))
# Get an actual list of the amphorae
amphorae = self.lb_admin_amphora_client.list_amphorae()
# There should be AT LEAST 2, there may be more depending on the
# configured topology, or if there are other LBs created besides ours
- self.assertTrue(
- len(amphorae) >= 2 * self._expected_amp_count(amphorae))
+ self.assertGreaterEqual(
+ len(amphorae), 2 * self._expected_amp_count(amphorae))
show_amphora_response_fields = const.SHOW_AMPHORA_RESPONSE_FIELDS
if self.lb_admin_amphora_client.is_version_supported(
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index aab78c1..741bb1c 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -302,8 +302,8 @@
network_kwargs = {
'name': data_utils.rand_name("lb_member_vip_network")}
if CONF.network_feature_enabled.port_security:
- # Note: Allowed Address Pairs requires port security
- network_kwargs['port_security_enabled'] = True
+ # Note: Allowed Address Pairs requires port security
+ network_kwargs['port_security_enabled'] = True
result = cls.lb_mem_net_client.create_network(**network_kwargs)
cls.lb_member_vip_net = result['network']
LOG.info('lb_member_vip_net: {}'.format(cls.lb_member_vip_net))
diff --git a/test-requirements.txt b/test-requirements.txt
index 47c128f..354a020 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
+hacking>=3.0,<3.1.0;python_version>='3.5' # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD