From 79ae9740ccceb89f5c7894eeb479f0f088846004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 14 May 2026 23:23:39 -0700 Subject: [PATCH] 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. --- tests/test_pgmq_backends.py | 16 ++++++++++------ tests/test_pgmq_bus.py | 6 +++++- tests/test_redis_bus.py | 6 +++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/test_pgmq_backends.py b/tests/test_pgmq_backends.py index ad2732a5e..8169cafc3 100644 --- a/tests/test_pgmq_backends.py +++ b/tests/test_pgmq_backends.py @@ -23,14 +23,18 @@ import unittest from dataclasses import dataclass 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 +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. # --------------------------------------------------------------------------- diff --git a/tests/test_pgmq_bus.py b/tests/test_pgmq_bus.py index b8c09d46f..b93defe4d 100644 --- a/tests/test_pgmq_bus.py +++ b/tests/test_pgmq_bus.py @@ -19,13 +19,17 @@ from pipecat.bus import ( BusJobRequestMessage, BusSubscriber, ) -from pipecat.bus.network.pgmq import PgmqBus from pipecat.bus.serializers import JSONMessageSerializer from pipecat.frames.frames import TextFrame from pipecat.pipeline.base_task import BaseTask from pipecat.processors.frame_processor import FrameDirection 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() diff --git a/tests/test_redis_bus.py b/tests/test_redis_bus.py index 0f1cc9511..21bace720 100644 --- a/tests/test_redis_bus.py +++ b/tests/test_redis_bus.py @@ -16,13 +16,17 @@ from pipecat.bus import ( BusJobRequestMessage, BusSubscriber, ) -from pipecat.bus.network.redis import RedisBus from pipecat.bus.serializers import JSONMessageSerializer from pipecat.frames.frames import TextFrame from pipecat.pipeline.base_task import BaseTask from pipecat.processors.frame_processor import FrameDirection 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()