Skip to content

Your lightweight open-source personal agent.

test(matrix): skip cleanly when optional deps are missing

haosenwang10187a6416bcb21a
diff --git a/tests/channels/test_matrix_channel.py b/tests/channels/test_matrix_channel.py
index 18a8e1097..27b7e1255 100644
--- a/tests/channels/test_matrix_channel.py
+++ b/tests/channels/test_matrix_channel.py
@@ -3,16 +3,14 @@ from pathlib import Path
from types import SimpleNamespace
import pytest
+
+pytest.importorskip("nio")
+pytest.importorskip("nh3")
+pytest.importorskip("mistune")
from nio import RoomSendResponse
from nanobot.channels.matrix import _build_matrix_text_content
-# Check optional matrix dependencies before importing
-try:
- import nh3 # noqa: F401
-except ImportError:
- pytest.skip("Matrix dependencies not installed (nh3)", allow_module_level=True)
-
import nanobot.channels.matrix as matrix_module
from nanobot.bus.events import OutboundMessage
from nanobot.bus.queue import MessageBus