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') subnet_name = subnet.get('name')
if str(subnet_name).startswith(const.SUBNET_NAME_PREFIX): if str(subnet_name).startswith(const.SUBNET_NAME_PREFIX):
app.neutron.delete_subnet(subnet['id']) app.neutron.delete_subnet(subnet['id'])
except n_exceptions.Conflict as ex: except n_exceptions.Conflict:
LOG.error("Subnet %s is in use, " LOG.error("Subnet %s is in use, "
"can't be deleted.", subnet['id']) "can't be deleted.", subnet['id'])
except n_exceptions.NeutronClientException as ex: 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 it's totally the normal case. So we'd just log that
# and continue to proceed. # and continue to proceed.
app.neutron.delete_subnet(subnet['id']) 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 " LOG.error("Subnet, %s, is in use. Network can't "
"be deleted.", subnet['id']) "be deleted.", subnet['id'])
raise raise
@@ -1856,7 +1856,7 @@ def ipam_release_pool():
try: try:
app.neutron.delete_subnetpool(pool_id) 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." LOG.info("The subnetpool with ID %s is still in use."
" It can't be deleted for now.", pool_id) " It can't be deleted for now.", pool_id)
except n_exceptions.NeutronClientException as ex: 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 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. 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) virtfns_path = "/sys/bus/pci/devices/%s/physfn/virtfn*" % (pci_addr)
vf_num = None vf_num = None
try: try:

View File

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

View File

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

View File

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

View File

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

View File

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