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.
This commit is contained in:
Adrian Sampson 2014-11-24 10:58:32 -08:00
parent d3b76d83d2
commit 42228e6d82
2 changed files with 1 additions and 2 deletions

View file

@ -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 = {}

View file

@ -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()