From 42228e6d82b76403985c992f56f7f52fa52001a3 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 24 Nov 2014 10:58:32 -0800 Subject: [PATCH] Tests: fix unload_plugins Don't mutate the base classes. This was causing plugins to break on the second test that uses them, since after they were unloaded their class-level fields were broken (since the modules are not re-loaded). This makes it more clear than ever that we need to encapsulate plugin loading state using some manner of PluginManager. --- test/helper.py | 2 -- test/test_permissions.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/helper.py b/test/helper.py index 875c99643..d23f94bf2 100644 --- a/test/helper.py +++ b/test/helper.py @@ -202,8 +202,6 @@ class TestHelper(object): """ # FIXME this should eventually be handled by a plugin manager beets.config['plugins'] = [] - for plugin in beets.plugins._classes: - plugin.listeners = None beets.plugins._classes = set() beets.plugins._instances = {} Item._types = {} diff --git a/test/test_permissions.py b/test/test_permissions.py index 9f3ae858c..1ba58312d 100644 --- a/test/test_permissions.py +++ b/test/test_permissions.py @@ -15,6 +15,7 @@ class PermissionsPluginTest(unittest.TestCase, TestHelper): def tearDown(self): self.teardown_beets() + self.unload_plugins() def test_permissions_on_album_imported(self): self.importer = self.create_importer()