Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: I71b869fc509cb46b55b1e88fae20422bcba085f7
This commit is contained in:
jacky06 2020-05-15 01:23:50 +08:00 committed by Hongbin Lu
parent 5c03de1668
commit 036703c8d4
7 changed files with 14 additions and 16 deletions

View File

@ -1044,7 +1044,7 @@ def network_driver_delete_network():
subnet_name = subnet.get('name')
if str(subnet_name).startswith(const.SUBNET_NAME_PREFIX):
app.neutron.delete_subnet(subnet['id'])
except n_exceptions.Conflict as ex:
except n_exceptions.Conflict:
LOG.error("Subnet %s is in use, "
"can't be deleted.", subnet['id'])
except n_exceptions.NeutronClientException as ex:
@ -1086,7 +1086,7 @@ def network_driver_delete_network():
# and it's totally the normal case. So we'd just log that
# and continue to proceed.
app.neutron.delete_subnet(subnet['id'])
except n_exceptions.Conflict as ex:
except n_exceptions.Conflict:
LOG.error("Subnet, %s, is in use. Network can't "
"be deleted.", subnet['id'])
raise
@ -1856,7 +1856,7 @@ def ipam_release_pool():
try:
app.neutron.delete_subnetpool(pool_id)
except n_exceptions.Conflict as ex:
except n_exceptions.Conflict:
LOG.info("The subnetpool with ID %s is still in use."
" It can't be deleted for now.", pool_id)
except n_exceptions.NeutronClientException as ex:

View File

@ -52,7 +52,7 @@ def get_vf_num_by_pci_address(pci_addr):
A VF is associated with an VF number, which ip link command uses to
configure it. This number can be obtained from the PCI device filesystem.
"""
VIRTFN_RE = re.compile("virtfn(\d+)")
VIRTFN_RE = re.compile(r"virtfn(\d+)")
virtfns_path = "/sys/bus/pci/devices/%s/physfn/virtfn*" % (pci_addr)
vf_num = None
try:

View File

@ -363,7 +363,6 @@ class TestKuryrBase(TestCase):
}],
"id": "65c0ee9f-d634-4522-8954-51021b570b0d",
"security_groups": [],
"device_id": ""
}
}
return fake_port

View File

@ -106,8 +106,8 @@ class TestNestedDriverFailures(base.TestKuryrFailures):
@mock.patch('kuryr_libnetwork.config.CONF')
def test__verify_binding_driver_compatibility_not_compatible(self, m_conf):
m_conf.binding.enabled_drivers = ['macvlan']
message = "Configuration file error: port driver 'veth' is not " \
"compatible with binding driver '\['macvlan'\]'"
message = r"Configuration file error: port driver 'veth' is not " \
r"compatible with binding driver '\['macvlan'\]'"
fake_driver = mock.Mock(spec=driver.Driver)
fake_driver.get_supported_bindings.return_value = ('veth',)
@ -118,8 +118,8 @@ class TestNestedDriverFailures(base.TestKuryrFailures):
def test__verify_binding_driver_compatibility_not_compatible_multi_drivers(
self, m_conf):
m_conf.binding.enabled_drivers = ['macvlan', 'sriov']
message = "Configuration file error: port driver 'veth' is not " \
"compatible with binding driver '\['macvlan'\, 'sriov']'"
message = r"Configuration file error: port driver 'veth' is not " \
r"compatible with binding driver '\['macvlan'\, 'sriov']'"
fake_driver = mock.Mock(spec=driver.Driver)
fake_driver.get_supported_bindings.return_value = ('veth',)
@ -129,8 +129,9 @@ class TestNestedDriverFailures(base.TestKuryrFailures):
@mock.patch('kuryr_libnetwork.config.CONF')
def test__verify_binding_driver_compatibility_not_supported(self, m_conf):
m_conf.binding.enabled_drivers = ['ipvlan']
message = "Configuration file error: binding driver '\['ipvlan'\]' is " \
"currently not supported with 'nested' port driver"
message = r"Configuration file error: binding driver " \
r"'\['ipvlan'\]' is currently not supported " \
r"with 'nested' port driver"
fake_driver = mock.Mock(spec=driver.Driver)
fake_driver.get_supported_bindings.return_value = ('ipvlan',)

View File

@ -25,12 +25,10 @@ eventlet==0.20.0
extras==1.0.0
fasteners==0.14.1
fixtures==3.0.0
flake8==2.5.5
Flask==0.10
future==0.16.0
futurist==1.6.0
greenlet==0.4.13
hacking==0.12.0
idna==2.6
imagesize==1.0.0
iso8601==0.1.12
@ -82,7 +80,6 @@ pep8==1.5.7
pika==0.10.0
pika-pool==0.1.3
prettytable==0.7.2
pyflakes==0.8.1
Pygments==2.2.0
pyinotify==0.9.6
pyparsing==2.2.0

View File

@ -2,11 +2,11 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=3.0.1,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT
docker>=2.4.2 # Apache-2.0
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
openstackdocstheme>=1.18.1 # Apache-2.0

View File

@ -55,7 +55,8 @@ commands =
[flake8]
# E128 continuation line under-indented for visual indent
ignore = E128
# W504 line break after binary operator
ignore = E128,W504
show-source = true
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,releasenotes