From bb7a0fb1cb339651bdf6e172431142562861263b Mon Sep 17 00:00:00 2001 From: zhulingjie Date: Sat, 5 Jan 2019 01:48:17 +0800 Subject: [PATCH] Update hacking version Use latest release 1.1.0 and compatible changes w.r.t pep8 Change-Id: Iaeebe7f3f76339f0c34c9e0f4db838ec192dbd83 --- .../tests/unit/db/test_bgp_db.py | 46 +++++++++---------- .../unit/services/bgp/driver/test_utils.py | 8 ++-- test-requirements.txt | 2 +- tox.ini | 5 +- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/neutron_dynamic_routing/tests/unit/db/test_bgp_db.py b/neutron_dynamic_routing/tests/unit/db/test_bgp_db.py index f09be469..a2491118 100644 --- a/neutron_dynamic_routing/tests/unit/db/test_bgp_db.py +++ b/neutron_dynamic_routing/tests/unit/db/test_bgp_db.py @@ -235,8 +235,8 @@ class BgpTests(BgpEntityCreationMixin): name='speaker1'),\ self.bgp_speaker(sp2['ip_version'], 4321, name='speaker2'): - speakers = self.bgp_plugin.get_bgp_speakers(self.context) - self.assertEqual(2, len(speakers)) + speakers = self.bgp_plugin.get_bgp_speakers(self.context) + self.assertEqual(2, len(speakers)) def test_bgp_speaker_update_local_as(self): local_as_1 = 1234 @@ -639,10 +639,9 @@ class BgpTests(BgpEntityCreationMixin): local_as, networks=[gw_net_id], advertise_fip_host_routes=fip_routes) as speaker: - routes = self.bgp_plugin.get_advertised_routes( - self.context, - speaker['id']) - return routes['advertised_routes'] + routes = self.bgp_plugin.get_advertised_routes( + self.context, speaker['id']) + return routes['advertised_routes'] def test__tenant_prefixes_by_router_no_gateway_port(self): with self.network() as net1, self.network() as net2,\ @@ -734,24 +733,23 @@ class BgpTests(BgpEntityCreationMixin): network=int_net, ip_version=6) as int_subnet,\ self.router() as router: - router_id = router['id'] - int_subnet_id = int_subnet['subnet']['id'] - ext_subnet_id = ext_subnet['subnet']['id'] - self.l3plugin.add_router_interface(self.context, - router_id, - {'subnet_id': - int_subnet_id}) - self.l3plugin.add_router_interface(self.context, - router_id, - {'subnet_id': - ext_subnet_id}) - with self.bgp_speaker(6, 1234, - networks=[gw_net_id]) as speaker: - bgp_speaker_id = speaker['id'] - cidrs = self.bgp_plugin.get_routes_by_bgp_speaker_id( - self.context, - bgp_speaker_id) - self.assertEqual(0, len(list(cidrs))) + router_id = router['id'] + int_subnet_id = int_subnet['subnet']['id'] + ext_subnet_id = ext_subnet['subnet']['id'] + self.l3plugin.add_router_interface(self.context, + router_id, + {'subnet_id': + int_subnet_id}) + self.l3plugin.add_router_interface(self.context, + router_id, + {'subnet_id': + ext_subnet_id}) + with self.bgp_speaker(6, 1234, + networks=[gw_net_id]) as speaker: + bgp_speaker_id = speaker['id'] + cidrs = self.bgp_plugin.get_routes_by_bgp_speaker_id( + self.context, bgp_speaker_id) + self.assertEqual(0, len(list(cidrs))) def test__get_routes_by_router_with_fip(self): gw_prefix = '172.16.10.0/24' diff --git a/neutron_dynamic_routing/tests/unit/services/bgp/driver/test_utils.py b/neutron_dynamic_routing/tests/unit/services/bgp/driver/test_utils.py index 53fb9708..96c68eee 100644 --- a/neutron_dynamic_routing/tests/unit/services/bgp/driver/test_utils.py +++ b/neutron_dynamic_routing/tests/unit/services/bgp/driver/test_utils.py @@ -50,10 +50,10 @@ class TestValidateMethod(base.BaseTestCase): bgp_driver_utils.validate_as_num('local_as', '64512') def test_validate_as_num_with_invalid_max_range(self): - allowed_range = ('\[' + + allowed_range = ('\\[' + str(bgp_consts.MIN_ASNUM) + '-' + str(bgp_consts.MAX_4BYTE_ASNUM) + - '\]') + '\\]') with self.assertRaisesRegex( bgp_driver_exc.InvalidParamRange, EXC_INV_PARAMRANGE % {'param': 'local_as', @@ -62,10 +62,10 @@ class TestValidateMethod(base.BaseTestCase): bgp_consts.MAX_4BYTE_ASNUM + 1) def test_validate_as_num_with_invalid_min_range(self): - allowed_range = ('\[' + + allowed_range = ('\\[' + str(bgp_consts.MIN_ASNUM) + '-' + str(bgp_consts.MAX_4BYTE_ASNUM) + - '\]') + '\\]') with self.assertRaisesRegex( bgp_driver_exc.InvalidParamRange, EXC_INV_PARAMRANGE % {'param': 'local_as', diff --git a/test-requirements.txt b/test-requirements.txt index 7e59b711..7a198919 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking<0.12,>=0.11.0 # Apache-2.0 +hacking>=1.1.0,<1.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD diff --git a/tox.ini b/tox.ini index 920c9dfb..7360d0a9 100644 --- a/tox.ini +++ b/tox.ini @@ -99,7 +99,10 @@ commands = python setup.py build_sphinx # N537 Log messages should not be translated # H106 Don’t put vim configuration in source files # H203 Use assertIs(Not)None to check for None -ignore = E125,E126,E128,E129,E265,H404,H405,N530,N537 +# W504 line break after binary operator +# (W503 and W504 are incompatible and we need to choose one of them. +# Existing codes follows W503, so we disable W504.) +ignore = E125,E126,E128,E129,E265,H404,H405,N530,N537,W504 enable-extensions=H106,H203 show-source = true exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios