changeset 4069:3d91d0aa68db

tests (unit): Skip XEP-0373 test if gpg can't be imported
author Goffi <goffi@goffi.org>
date Thu, 01 Jun 2023 21:37:34 +0200
parents 5241267a92b3
children d10748475025
files tests/unit/test_plugin_xep_0373.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/unit/test_plugin_xep_0373.py	Thu Jun 01 21:37:31 2023 +0200
+++ b/tests/unit/test_plugin_xep_0373.py	Thu Jun 01 21:37:34 2023 +0200
@@ -1,8 +1,12 @@
 from datetime import datetime, timedelta, timezone
-from sat.plugins.plugin_xep_0373 import XEP_0373, NS_OX
-from sat.tools.xmpp_datetime import parse_datetime
 
 import pytest
+from sat.core import exceptions
+try:
+    from sat.plugins.plugin_xep_0373 import XEP_0373, NS_OX
+except exceptions.MissingModule as e:
+    pytest.skip(f"Can't test XEP-0373: {e}", allow_module_level=True)
+from sat.tools.xmpp_datetime import parse_datetime
 from twisted.words.protocols.jabber import jid