Support hacking 2.0.0

Eventually hacking will move to 2.0.0 (diskimage-builder
is holding it back), and when it does there will be a few
errors to fix.  We can get ahead of it so it doesn't
break us with some small changes for these items:

  F601 dictionary key $item repeated with different values
  F632 use ==/!= to compare str, bytes, and int literals
  E501 line too long

While doing this noticed the lower-constraints.txt for
hacking was set at 0.12.0, when test-requirements.txt
had it at 1.1.0, so fixed that as well.

Change-Id: I80d2a5f97e7a4896a8fa765c1971c8bb7e72d211
This commit is contained in:
Brian Haley 2019-12-16 16:45:25 -05:00 committed by Michael Johnson
parent af9edc30d7
commit c6db3e4f17
9 changed files with 34 additions and 25 deletions

View File

@ -45,7 +45,7 @@ gitdb2==2.0.3
GitPython==2.1.8
greenlet==0.4.13
gunicorn==19.9.0
hacking==0.12.0
hacking==1.1.0
idna==2.6
imagesize==1.0.0
ipaddress==1.0.17

View File

@ -345,7 +345,8 @@ class PaginationHelper(object):
default = PaginationHelper._get_default_column_value(
model_attr.property.columns[0].type)
attr = sa_sql.expression.case(
[(model_attr != None, # noqa: E711 # pylint: disable=singleton-comparison
# pylint: disable=singleton-comparison
[(model_attr != None, # noqa E711
model_attr), ], else_=default)
crit_attrs.append((attr == marker_values[j]))
@ -353,7 +354,8 @@ class PaginationHelper(object):
default = PaginationHelper._get_default_column_value(
model_attr.property.columns[0].type)
attr = sa_sql.expression.case(
[(model_attr != None, # noqa: E711 # pylint: disable=singleton-comparison
# pylint: disable=singleton-comparison
[(model_attr != None, # noqa E711
model_attr), ], else_=default)
this_sort_dir = self.sort_keys[i][1]
if this_sort_dir == constants.DESC:

View File

@ -53,6 +53,7 @@ def retryMaskFilter(record):
return False
return True
LOG.logger.addFilter(retryMaskFilter)

View File

@ -1552,8 +1552,8 @@ class TestLoadBalancer(base.BaseAPITest):
lbs = self.get(
self.LBS_PATH,
params={'name': 'lb1', 'tags': 'test_tag2',
'vip_address': '10.0.0.1', 'tags': 'test_tag1'}
params={'name': 'lb1', 'tags': 'test_tag1',
'vip_address': '10.0.0.1'}
).json.get(self.root_tag_list)
self.assertIsInstance(lbs, list)
self.assertEqual(1, len(lbs))
@ -1561,8 +1561,8 @@ class TestLoadBalancer(base.BaseAPITest):
lbs = self.get(
self.LBS_PATH,
params={'name': 'lb1', 'tags': 'test_tag2',
'vip_address': '10.0.0.1', 'tags': 'test_tag3'}
params={'name': 'lb1', 'tags': 'test_tag3',
'vip_address': '10.0.0.1'}
).json.get(self.root_tag_list)
self.assertIsInstance(lbs, list)
self.assertEqual(0, len(lbs))

View File

@ -33,11 +33,15 @@ LISTENER_ID1 = uuidutils.generate_uuid()
LISTENER_ID2 = uuidutils.generate_uuid()
LISTENER_IDS = [LISTENER_ID1, LISTENER_ID2]
BASE_PATH = '/tmp/test'
SAMPLE_POOL_STATUS = {'432fc8b3-d446-48d4-bb64-13beb90e22bc': {
'status': 'UP',
'uuid': '432fc8b3-d446-48d4-bb64-13beb90e22bc',
'members': {
'302e33d9-dee1-4de9-98d5-36329a06fb58': 'DOWN'}}}
SAMPLE_POOL_STATUS = {
'432fc8b3-d446-48d4-bb64-13beb90e22bc': {
'status': 'UP',
'uuid': '432fc8b3-d446-48d4-bb64-13beb90e22bc',
'members': {'302e33d9-dee1-4de9-98d5-36329a06fb58': 'DOWN'}},
'3661ed10-99db-4d2c-bffb-99b60eb876ff': {
'status': 'UP',
'uuid': '3661ed10-99db-4d2c-bffb-99b60eb876ff',
'members': {'e657f950-a6a2-4d28-bffa-0c8a8c05f815': 'DOWN'}}}
SAMPLE_BOGUS_POOL_STATUS = {LISTENER_ID1: {
'status': 'UP',
@ -112,11 +116,13 @@ SAMPLE_STATS_MSG = {
'tx': 0, 'rx': 0, 'ereq': 0},
'status': 'OPEN'},
},
'pools': {'432fc8b3-d446-48d4-bb64-13beb90e22bc': {
'members': {'302e33d9-dee1-4de9-98d5-36329a06fb58': 'DOWN'},
'status': 'UP'}, '432fc8b3-d446-48d4-bb64-13beb90e22bc': {
'members': {'302e33d9-dee1-4de9-98d5-36329a06fb58': 'DOWN'},
'status': 'UP'},
'pools': {
'432fc8b3-d446-48d4-bb64-13beb90e22bc': {
'members': {'302e33d9-dee1-4de9-98d5-36329a06fb58': 'DOWN'},
'status': 'UP'},
'3661ed10-99db-4d2c-bffb-99b60eb876ff': {
'members': {'e657f950-a6a2-4d28-bffa-0c8a8c05f815': 'DOWN'},
'status': 'UP'},
},
'id': None,
'seq': 0,

View File

@ -602,9 +602,9 @@ def sample_listener_tuple(proto=None, monitor=True, alloc_default_pool=True,
provisioning_status=constants.ACTIVE):
proto = 'HTTP' if proto is None else proto
if be_proto is None:
be_proto = 'HTTP' if proto is 'TERMINATED_HTTPS' else proto
be_proto = 'HTTP' if proto == 'TERMINATED_HTTPS' else proto
topology = 'SINGLE' if topology is None else topology
port = '443' if proto is 'HTTPS' or proto is 'TERMINATED_HTTPS' else '80'
port = '443' if proto in ['HTTPS', 'TERMINATED_HTTPS'] else '80'
peer_port = 1024 if peer_port is None else peer_port
insert_headers = insert_headers or {}
in_listener = collections.namedtuple(
@ -860,7 +860,7 @@ def sample_session_persistence_tuple(persistence_type=None,
def sample_health_monitor_tuple(proto='HTTP', sample_hm=1,
host_http_check=False,
provisioning_status=constants.ACTIVE):
proto = 'HTTP' if proto is 'TERMINATED_HTTPS' else proto
proto = 'HTTP' if proto == 'TERMINATED_HTTPS' else proto
monitor = collections.namedtuple(
'monitor', 'id, type, delay, timeout, fall_threshold, rise_threshold,'
'http_method, url_path, expected_codes, enabled, '

View File

@ -625,9 +625,9 @@ def sample_listener_tuple(proto=None, monitor=True, alloc_default_pool=True,
provisioning_status=constants.ACTIVE):
proto = 'HTTP' if proto is None else proto
if be_proto is None:
be_proto = 'HTTP' if proto is 'TERMINATED_HTTPS' else proto
be_proto = 'HTTP' if proto == 'TERMINATED_HTTPS' else proto
topology = 'SINGLE' if topology is None else topology
port = '443' if proto is 'HTTPS' or proto is 'TERMINATED_HTTPS' else '80'
port = '443' if proto in ['HTTPS', 'TERMINATED_HTTPS'] else '80'
peer_port = 1024 if peer_port is None else peer_port
insert_headers = insert_headers or {}
in_listener = collections.namedtuple(
@ -879,7 +879,7 @@ def sample_session_persistence_tuple(persistence_type=None,
def sample_health_monitor_tuple(proto='HTTP', sample_hm=1,
host_http_check=False,
provisioning_status=constants.ACTIVE):
proto = 'HTTP' if proto is 'TERMINATED_HTTPS' else proto
proto = 'HTTP' if proto == 'TERMINATED_HTTPS' else proto
monitor = collections.namedtuple(
'monitor', 'id, type, delay, timeout, fall_threshold, rise_threshold,'
'http_method, url_path, expected_codes, enabled, '

View File

@ -460,7 +460,7 @@ class TestUpdateHealthDb(base.TestCase):
"pool-id-1:listener-id-1": {
"status": constants.UP,
"members": {"member-id-1": constants.UP}},
"pool-id-1:listener-id-1": {
"pool-id-1:listener-id-2": {
"status": constants.UP,
"members": {"member-id-1": constants.UP}}},
"recv_time": time.time()

View File

@ -9,7 +9,7 @@ flake8-import-order==0.12 # LGPLv3
mock>=2.0.0 # BSD
python-subunit>=1.0.0 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0
pylint>=1.9.2 # GPLv2
pylint>=2.2.0 # GPLv2
testrepository>=0.0.18 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
testresources>=2.0.0 # Apache-2.0/BSD