From 9b0be1ca2b1f8d0efaf9f5acdecaaa2e25faf629 Mon Sep 17 00:00:00 2001 From: nicoco Date: Thu, 23 Feb 2023 06:32:17 +0100 Subject: [PATCH 1/3] 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 --- slixmpp/basexmpp.py | 4 ++-- slixmpp/plugins/__init__.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/slixmpp/basexmpp.py b/slixmpp/basexmpp.py index c54ec63a..c0da516f 100644 --- a/slixmpp/basexmpp.py +++ b/slixmpp/basexmpp.py @@ -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) diff --git a/slixmpp/plugins/__init__.py b/slixmpp/plugins/__init__.py index 232f0584..206ac5a7 100644 --- a/slixmpp/plugins/__init__.py +++ b/slixmpp/plugins/__init__.py @@ -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', ] From 5efa9804badd6d714d99e03172ccdda3471e4d63 Mon Sep 17 00:00:00 2001 From: nicoco Date: Thu, 23 Feb 2023 06:36:13 +0100 Subject: [PATCH 2/3] xep0292: test: declare `suite` --- tests/test_stanza_xep_0292.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_stanza_xep_0292.py b/tests/test_stanza_xep_0292.py index 8b2467fb..48606c92 100644 --- a/tests/test_stanza_xep_0292.py +++ b/tests/test_stanza_xep_0292.py @@ -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) From 700ce6b32ed054b175a12277d1cae0020853229f Mon Sep 17 00:00:00 2001 From: nicoco Date: Thu, 23 Feb 2023 06:36:41 +0100 Subject: [PATCH 3/3] xep0461: fix typo in test --- tests/test_stanza_xep_0461.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_stanza_xep_0461.py b/tests/test_stanza_xep_0461.py index e43b8138..f6f21210 100644 --- a/tests/test_stanza_xep_0461.py +++ b/tests/test_stanza_xep_0461.py @@ -33,7 +33,7 @@ class TestReply(SlixTest): self.check( message, """ - M + 12345\nrealbody