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
This commit is contained in:
Andreas Jaeger 2020-03-28 20:13:46 +01:00
parent 0ae7f108b9
commit 4215b7085f
4 changed files with 10 additions and 9 deletions

View File

@ -270,7 +270,7 @@ class ActiveStandbyScenarioTest(test_base.LoadBalancerBaseTestWithCompute):
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(

View File

@ -96,8 +96,8 @@ class AmphoraScenarioTest(test_base.LoadBalancerBaseTest):
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 @@ class AmphoraScenarioTest(test_base.LoadBalancerBaseTest):
# 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(

View File

@ -302,8 +302,8 @@ class LoadBalancerBaseTest(test.BaseTestCase):
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))

View File

@ -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