From ceac1a94a8a9400e7e46e7860f628215a8f56336 Mon Sep 17 00:00:00 2001 From: Armando Migliaccio Date: Fri, 16 Sep 2016 11:06:22 -0700 Subject: [PATCH] Stop using _create_or_update_agent There is a public method, use it instead! Closes-bug: #1624496 (cherry picked from commit b4c840d97b828c4f81c813f41f3de5f1355f2896) Change-Id: Ie076a2860a54c5e2958c16593c3f39f86353cd34 pep8: switched to neutron-lib hacking checks A recent hacking check landed in neutron broke the pep8 target for the repo. Using hacking checks from neutron is error prone. This patch switches the repo to checks from neutron-lib. It also skips N530 check because the repo still imports from neutron.* (cherry picked from commit fa11d9a0a5af3b9a9714bbfa82b6dc7b9f40e5df) Change-Id: I70ce6698a3f25af39917ec7bdf1a31a1d4cabf89 --- .../tests/unit/db/test_bgp_db.py | 32 +++++++++---------- tox.ini | 5 +-- 2 files changed, 19 insertions(+), 18 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 ab94f576..77b8d448 100644 --- a/neutron_dynamic_routing/tests/unit/db/test_bgp_db.py +++ b/neutron_dynamic_routing/tests/unit/db/test_bgp_db.py @@ -895,11 +895,11 @@ class BgpTests(test_plugin.Ml2PluginV2TestCase, portbindings.HOST_ID: 'test-host'}} fixed_port = self.plugin.create_port(self.context, fixed_port_data) - self.plugin._create_or_update_agent(self.context, - {'agent_type': 'L3 agent', - 'host': 'test-host', - 'binary': 'neutron-l3-agent', - 'topic': 'test'}) + self.plugin.create_or_update_agent(self.context, + {'agent_type': 'L3 agent', + 'host': 'test-host', + 'binary': 'neutron-l3-agent', + 'topic': 'test'}) fip_gw = self.l3plugin.create_fip_agent_gw_port_if_not_exists( self.context, gw_net_id, @@ -960,11 +960,11 @@ class BgpTests(test_plugin.Ml2PluginV2TestCase, portbindings.HOST_ID: 'test-host'}} fixed_port = self.plugin.create_port(self.context, fixed_port_data) - self.plugin._create_or_update_agent(self.context, - {'agent_type': 'L3 agent', - 'host': 'test-host', - 'binary': 'neutron-l3-agent', - 'topic': 'test'}) + self.plugin.create_or_update_agent(self.context, + {'agent_type': 'L3 agent', + 'host': 'test-host', + 'binary': 'neutron-l3-agent', + 'topic': 'test'}) fip_gw = self.l3plugin.create_fip_agent_gw_port_if_not_exists( self.context, gw_net_id, @@ -1016,11 +1016,11 @@ class BgpTests(test_plugin.Ml2PluginV2TestCase, portbindings.HOST_ID: 'test-host'}} fixed_port = self.plugin.create_port(self.context, fixed_port_data) - self.plugin._create_or_update_agent(self.context, - {'agent_type': 'L3 agent', - 'host': 'test-host', - 'binary': 'neutron-l3-agent', - 'topic': 'test'}) + self.plugin.create_or_update_agent(self.context, + {'agent_type': 'L3 agent', + 'host': 'test-host', + 'binary': 'neutron-l3-agent', + 'topic': 'test'}) fip_gw = self.l3plugin.create_fip_agent_gw_port_if_not_exists( self.context, gw_net_id, @@ -1128,7 +1128,7 @@ class BgpTests(test_plugin.Ml2PluginV2TestCase, def _create_scenario_test_l3_agents(self, agent_confs): for item in agent_confs: - self.plugin._create_or_update_agent( + self.plugin.create_or_update_agent( self.context, {'agent_type': 'L3 agent', 'host': item['host'], diff --git a/tox.ini b/tox.ini index 2b23ff89..f7c5a213 100644 --- a/tox.ini +++ b/tox.ini @@ -76,7 +76,8 @@ commands = python setup.py build_sphinx # E265 block comment should start with ‘# ‘ # H405 multi line docstring summary not separated with an empty line # TODO(marun) H404 multi line docstring should start with a summary -ignore = E125,E126,E128,E129,E265,H404,H405 +# N530 direct neutron imports not allowed +ignore = E125,E126,E128,E129,E265,H404,H405,N530 show-source = true exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios @@ -89,7 +90,7 @@ commands = [hacking] import_exceptions = neutron_dynamic_routing._i18n -local-check-factory = neutron.hacking.checks.factory +local-check-factory = neutron_lib.hacking.checks.factory [testenv:genconfig] commands = {toxinidir}/tools/generate_config_file_samples.sh