From 4df57cd8fefc158ed79c15b18749b09c8659e224 Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Mon, 28 Jan 2019 12:16:02 +0100 Subject: [PATCH] Fix DeprecationWarning about using __plugin_implementations__ --- tests/plugin/test_core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/plugin/test_core.py b/tests/plugin/test_core.py index b14f46a58..4dd7ce3da 100644 --- a/tests/plugin/test_core.py +++ b/tests/plugin/test_core.py @@ -70,8 +70,15 @@ class PluginTestCase(unittest.TestCase): plugin_entry_points, plugin_disabled_list=[], logging_prefix="logging_prefix.") - self.plugin_manager.reload_plugins(startup=True, initialize_implementations=False) - self.plugin_manager.initialize_implementations() + # This may warn about __plugin_implementations__ + import warnings + with warnings.catch_warnings(record=True) as w: + self.plugin_manager.reload_plugins(startup=True, initialize_implementations=False) + self.plugin_manager.initialize_implementations() + if len(w): + assert len(w) == 1 + assert issubclass(w[-1].category, DeprecationWarning) + assert "__plugin_implementation__" in str(w[-1].message) def test_plugin_loading(self): self.assertEqual(7, len(self.plugin_manager.enabled_plugins))