stop misusing __all__ for default plugin list

this fixes tests by renaming the list of default plugins
from __all__ (which has a special meaning) to a separate
list called PLUGINS

no need to put BasePlugin in __all__ after all
if we don't use __all__ at all
This commit is contained in:
nicoco 2023-02-23 06:32:17 +01:00
parent af07864cbb
commit 9b0be1ca2b
2 changed files with 11 additions and 4 deletions

View file

@ -279,10 +279,10 @@ class BaseXMPP(XMLStream):
if self.plugin_whitelist:
plugin_list = self.plugin_whitelist
else:
plugin_list = plugins.__all__
plugin_list = plugins.PLUGINS
for plugin in plugin_list:
if plugin in plugins.__all__:
if plugin in plugins.PLUGINS:
self.register_plugin(plugin)
else:
raise NameError("Plugin %s not in plugins.__all__." % plugin)

View file

@ -6,7 +6,7 @@ from slixmpp.plugins.base import PluginManager, PluginNotFound, BasePlugin
from slixmpp.plugins.base import register_plugin, load_plugin
__all__ = [
PLUGINS = [
# XEPS
'xep_0004', # Data Forms
'xep_0009', # Jabber-RPC
@ -116,5 +116,12 @@ __all__ = [
'xep_0444', # Message Reactions
'xep_0461', # Message Replies
# Meant to be imported by plugins
'BasePlugin'
]
__all__ = PLUGINS + [
'PluginManager',
'PluginNotFound',
'BasePlugin',
'register_plugin',
'load_plugin',
]