From fbdd642df6d31a8d3762df0b3c67fe8ce8d1a23c Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 20 Jun 2025 21:47:40 +0900 Subject: [PATCH] Drop unused method As described in the TODO comment, this method is not at all used. Also loose the minimum boundary of coverage percentage, because the limit matches the exact percentage of current tests and can be easily broken. Change-Id: Idd9f4ade3911b21691f220c5eafa09463689b8b3 --- neutron/manager.py | 10 ---------- neutron/tests/unit/test_manager.py | 18 ------------------ tox.ini | 2 +- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/neutron/manager.py b/neutron/manager.py index aea913c5972..8b5925901a0 100644 --- a/neutron/manager.py +++ b/neutron/manager.py @@ -274,16 +274,6 @@ class NeutronManager(metaclass=profiler.TracedMeta): resource, res_ctrl_mappings.get(resource.replace('-', '_'))) - # TODO(blogan): This isn't used by anything else other than tests and - # probably should be removed - @classmethod - def get_service_plugin_by_path_prefix(cls, path_prefix): - service_plugins = directory.get_unique_plugins() - for service_plugin in service_plugins: - plugin_path_prefix = getattr(service_plugin, 'path_prefix', None) - if plugin_path_prefix and plugin_path_prefix == path_prefix: - return service_plugin - @classmethod def add_resource_for_path_prefix(cls, resource, path_prefix): resources = cls.get_instance().path_prefix_resource_mappings[ diff --git a/neutron/tests/unit/test_manager.py b/neutron/tests/unit/test_manager.py index 0aa14860060..7a8da5ccf8d 100644 --- a/neutron/tests/unit/test_manager.py +++ b/neutron/tests/unit/test_manager.py @@ -14,7 +14,6 @@ # under the License. from unittest import mock -import weakref import fixtures from neutron_lib.plugins import constants as lib_const @@ -248,20 +247,3 @@ class NeutronManagerTestCase(base.BaseTestCase): with testlib_api.ExpectedException(ImportError): manager.NeutronManager.load_class_for_provider( 'neutron.core_plugins', 'ml2XXXXXX') - - def test_get_service_plugin_by_path_prefix_3(self): - cfg.CONF.set_override("core_plugin", DB_PLUGIN_KLASS) - nm = manager.NeutronManager.get_instance() - - class pclass: - def __init__(self, path_prefix): - self.path_prefix = path_prefix - - x_plugin, y_plugin = pclass('xpa'), pclass('ypa') - directory.add_plugin('x', x_plugin) - directory.add_plugin('y', y_plugin) - self.assertEqual(weakref.proxy(x_plugin), - nm.get_service_plugin_by_path_prefix('xpa')) - self.assertEqual(weakref.proxy(y_plugin), - nm.get_service_plugin_by_path_prefix('ypa')) - self.assertIsNone(nm.get_service_plugin_by_path_prefix('abc')) diff --git a/tox.ini b/tox.ini index 2656e1caea7..19c3b6570cb 100644 --- a/tox.ini +++ b/tox.ini @@ -181,7 +181,7 @@ setenv = commands = stestr run --no-subunit-trace {posargs} coverage combine - coverage report --fail-under=82 --skip-covered + coverage report --fail-under=80 --skip-covered coverage html -d cover coverage xml -o cover/coverage.xml