Skip pgmq/redis bus tests when their extras are not installed
The PGMQ and Redis bus modules raise an ``Exception`` at import time when the optional ``pgmq`` / ``redis`` packages are missing, which broke ``pytest`` collection in environments without those extras (e.g. CI that uses ``--no-extra gstreamer --no-extra local``). Wrap the imports in ``try/except`` and ``raise unittest.SkipTest`` so the whole test module is skipped cleanly instead of failing collection.
This commit is contained in:
@@ -23,14 +23,18 @@ import unittest
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from pipecat.bus import BusDataMessage
|
from pipecat.bus import BusDataMessage
|
||||||
from pipecat.bus.network.pgmq import PgmqBus
|
|
||||||
from pipecat.bus.network.pgmq_backends import (
|
|
||||||
BackendMessage,
|
|
||||||
IsolatedPgmqBackend,
|
|
||||||
PgmqBackend,
|
|
||||||
)
|
|
||||||
from pipecat.utils.asyncio.task_manager import TaskManager, TaskManagerParams
|
from pipecat.utils.asyncio.task_manager import TaskManager, TaskManagerParams
|
||||||
|
|
||||||
|
try:
|
||||||
|
from pipecat.bus.network.pgmq import PgmqBus
|
||||||
|
from pipecat.bus.network.pgmq_backends import (
|
||||||
|
BackendMessage,
|
||||||
|
IsolatedPgmqBackend,
|
||||||
|
PgmqBackend,
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
raise unittest.SkipTest("pgmq extra not installed (`pip install pipecat-ai[pgmq]`)")
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# IsolatedPgmqBackend: assert it speaks the right SQL to asyncpg.
|
# IsolatedPgmqBackend: assert it speaks the right SQL to asyncpg.
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -19,13 +19,17 @@ from pipecat.bus import (
|
|||||||
BusJobRequestMessage,
|
BusJobRequestMessage,
|
||||||
BusSubscriber,
|
BusSubscriber,
|
||||||
)
|
)
|
||||||
from pipecat.bus.network.pgmq import PgmqBus
|
|
||||||
from pipecat.bus.serializers import JSONMessageSerializer
|
from pipecat.bus.serializers import JSONMessageSerializer
|
||||||
from pipecat.frames.frames import TextFrame
|
from pipecat.frames.frames import TextFrame
|
||||||
from pipecat.pipeline.base_task import BaseTask
|
from pipecat.pipeline.base_task import BaseTask
|
||||||
from pipecat.processors.frame_processor import FrameDirection
|
from pipecat.processors.frame_processor import FrameDirection
|
||||||
from pipecat.utils.asyncio.task_manager import TaskManager, TaskManagerParams
|
from pipecat.utils.asyncio.task_manager import TaskManager, TaskManagerParams
|
||||||
|
|
||||||
|
try:
|
||||||
|
from pipecat.bus.network.pgmq import PgmqBus
|
||||||
|
except Exception:
|
||||||
|
raise unittest.SkipTest("pgmq extra not installed (`pip install pipecat-ai[pgmq]`)")
|
||||||
|
|
||||||
_sub_counter = itertools.count()
|
_sub_counter = itertools.count()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,17 @@ from pipecat.bus import (
|
|||||||
BusJobRequestMessage,
|
BusJobRequestMessage,
|
||||||
BusSubscriber,
|
BusSubscriber,
|
||||||
)
|
)
|
||||||
from pipecat.bus.network.redis import RedisBus
|
|
||||||
from pipecat.bus.serializers import JSONMessageSerializer
|
from pipecat.bus.serializers import JSONMessageSerializer
|
||||||
from pipecat.frames.frames import TextFrame
|
from pipecat.frames.frames import TextFrame
|
||||||
from pipecat.pipeline.base_task import BaseTask
|
from pipecat.pipeline.base_task import BaseTask
|
||||||
from pipecat.processors.frame_processor import FrameDirection
|
from pipecat.processors.frame_processor import FrameDirection
|
||||||
from pipecat.utils.asyncio.task_manager import TaskManager, TaskManagerParams
|
from pipecat.utils.asyncio.task_manager import TaskManager, TaskManagerParams
|
||||||
|
|
||||||
|
try:
|
||||||
|
from pipecat.bus.network.redis import RedisBus
|
||||||
|
except Exception:
|
||||||
|
raise unittest.SkipTest("redis extra not installed (`pip install pipecat-ai[redis]`)")
|
||||||
|
|
||||||
_sub_counter = itertools.count()
|
_sub_counter = itertools.count()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user