mirror of
https://github.com/beetbox/beets.git
synced 2026-02-16 12:24:53 +01:00
Set the class module during plugin registration to not trigger the plugin
load dedup.
This commit is contained in:
parent
b325c5a2d8
commit
b839bf6b05
2 changed files with 4 additions and 6 deletions
|
|
@ -571,12 +571,10 @@ class PluginMixin(TestHelper):
|
|||
beetsplug_pkg.__path__ = []
|
||||
sys.modules[PLUGIN_NAMESPACE] = beetsplug_pkg
|
||||
|
||||
# Create the plugin module
|
||||
if full_namespace in sys.modules:
|
||||
raise ValueError(f"Plugin {name} already registered")
|
||||
module = types.ModuleType(full_namespace)
|
||||
module.__file__ = f"<{full_namespace}>"
|
||||
module.__package__ = PLUGIN_NAMESPACE
|
||||
plugin_class.__module__ = full_namespace
|
||||
setattr(module, plugin_class.__name__, plugin_class)
|
||||
|
||||
# Register in sys.modules and as attribute of parent package
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ class TestPluginRegistration(PluginTest):
|
|||
delimiter = types.MULTI_VALUE_DSV.delimiter
|
||||
assert out == f"one{delimiter}two{delimiter}three\n"
|
||||
|
||||
def test_duplicate_field_typ(self):
|
||||
"""Test that if another plugin tries to register the same type,
|
||||
a PluginConflictError is raised.
|
||||
def test_duplicate_field_type(self):
|
||||
"""A PluginConflictError should be raised if
|
||||
another plugin tries to register the same field_type str.
|
||||
"""
|
||||
|
||||
class DuplicateDummyPlugin(plugins.BeetsPlugin):
|
||||
|
|
|
|||
Loading…
Reference in a new issue