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: Ib80f2494f0355f6eafcd1df7f7822e31e9e64c40
This commit is contained in:
jacky06 2020-05-12 23:52:46 +08:00
parent 9b8177a2cb
commit 31fe6d7544
6 changed files with 13 additions and 8 deletions

View File

@ -71,7 +71,7 @@ class UpdateHost(tables.LinkAction):
classes = ("ajax-modal",)
def get_link_url(self, datum):
host_id = datum.uuid+','+datum.failover_segment_id
host_id = datum.uuid + ',' + datum.failover_segment_id
url = "horizon:masakaridashboard:hosts:update"
return reverse(url, args=[host_id])

View File

@ -97,7 +97,7 @@ class HostTest(test.TestCase):
def test_detail(self):
host = self.masakari_host.list()[0]
id_to_update = host.uuid+','+host.failover_segment_id
id_to_update = host.uuid + ',' + host.failover_segment_id
detail_url = reverse('horizon:masakaridashboard:hosts:detail',
args=[id_to_update])
with mock.patch('masakaridashboard.api.api.get_host',
@ -112,7 +112,7 @@ class HostTest(test.TestCase):
def test_update(self):
host_to_update = self.masakari_host.list()[0]
id_to_update = (
host_to_update.uuid+','+host_to_update.failover_segment_id)
host_to_update.uuid + ',' + host_to_update.failover_segment_id)
update_url = reverse('horizon:masakaridashboard:hosts:update',
args=[id_to_update])
host_to_update.control_attributes = 'fake'

View File

@ -23,9 +23,9 @@ HORIZON_CONFIG.pop('dashboards', None)
HORIZON_CONFIG.pop('default_dashboard', None)
# Update the dashboards with masakaridashboard
from masakaridashboard.local import enabled
import openstack_dashboard.enabled
from openstack_dashboard.utils import settings
from masakaridashboard.local import enabled # noqa
import openstack_dashboard.enabled # noqa
from openstack_dashboard.utils import settings # noqa
settings.update_dashboards(
[

View File

@ -59,7 +59,7 @@ def data(TEST):
TEST.hypervisors = test_data_utils.TestDataContainer()
hypervisor1 = Hypervisor(
HypervisorManager, {'id': '1', 'hypervisor_hostname': "test"})
HypervisorManager, {'id': '1', 'hypervisor_hostname': "test"})
TEST.hypervisors.add(hypervisor1)

View File

@ -7,7 +7,7 @@
# be installed in a specific order.
#
# Hacking should appear first in case something else depends on pep8
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=3.0.1,<3.1.0 # Apache-2.0
# Testing Requirements
coverage!=4.4,>=4.0 # Apache-2.0

View File

@ -74,5 +74,10 @@ commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[flake8]
# F405 TEMPLATES may be undefined, or defined from star imports
# (because it is not easy to avoid this in openstack_dashboard.test.settings)
# (W503 and W504 are incompatible and we need to choose one of them.
# Existing codes follows W503, so we disable W504.)
ignore = F405,W504
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,node_modules
max-complexity = 20