test(matrix): skip cleanly when optional deps are missing
This commit is contained in:
committed by
Xubin Ren
parent
cc33057985
commit
7a6416bcb2
@@ -3,16 +3,14 @@ from pathlib import Path
|
|||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
pytest.importorskip("nio")
|
||||||
|
pytest.importorskip("nh3")
|
||||||
|
pytest.importorskip("mistune")
|
||||||
from nio import RoomSendResponse
|
from nio import RoomSendResponse
|
||||||
|
|
||||||
from nanobot.channels.matrix import _build_matrix_text_content
|
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
|
import nanobot.channels.matrix as matrix_module
|
||||||
from nanobot.bus.events import OutboundMessage
|
from nanobot.bus.events import OutboundMessage
|
||||||
from nanobot.bus.queue import MessageBus
|
from nanobot.bus.queue import MessageBus
|
||||||
|
|||||||
Reference in New Issue
Block a user