Merge branch 'fix-tests' into 'master'

Fix tests and stop misusing __all__

See merge request poezio/slixmpp!229
This commit is contained in:
Maxime Buquet 2023-02-23 17:04:13 +00:00
commit 1f934d375c
4 changed files with 15 additions and 5 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',
]

View file

@ -1,4 +1,5 @@
import datetime
import unittest
from slixmpp import Iq
from slixmpp.test import SlixTest
@ -116,3 +117,5 @@ class TestVcard(SlixTest):
""",
use_values=False
)
suite = unittest.TestLoader().loadTestsFromTestCase(TestVcard)

View file

@ -33,7 +33,7 @@ class TestReply(SlixTest):
self.check(
message,
"""
<message xmlns="jabber:client">M
<message xmlns="jabber:client">
<body>12345\nrealbody</body>
<fallback xmlns='urn:xmpp:feature-fallback:0' for='NS'>
<body start="0" end="6" />