From 9ecb00d0970c8f437a3a680b01b72e93c6de76f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 14 May 2026 23:25:28 -0700 Subject: [PATCH] Skip pgmq/redis lazy-import tests when their extras are not installed ``test_pgmq_bus_lazy_import`` and ``test_redis_bus_lazy_import`` import ``pipecat.bus.network.pgmq`` / ``redis`` directly, which raises when the optional ``pgmq`` / ``redis`` packages are missing. Gate each test with ``@unittest.skipUnless`` on a top-level probe of the underlying package so they're skipped (not errored) in environments without the extras. ``test_unknown_attribute_raises`` is unaffected. --- tests/test_bus_network.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_bus_network.py b/tests/test_bus_network.py index fdba47db4..ab5b7fd18 100644 --- a/tests/test_bus_network.py +++ b/tests/test_bus_network.py @@ -10,14 +10,30 @@ import unittest import pipecat.bus.network as network +try: + import pgmq # noqa: F401 + + PGMQ_AVAILABLE = True +except ImportError: + PGMQ_AVAILABLE = False + +try: + import redis # noqa: F401 + + REDIS_AVAILABLE = True +except ImportError: + REDIS_AVAILABLE = False + class TestNetworkPackageLazyImports(unittest.TestCase): + @unittest.skipUnless(PGMQ_AVAILABLE, "pgmq extra not installed") def test_pgmq_bus_lazy_import(self): """``PgmqBus`` is resolved on first attribute access.""" from pipecat.bus.network.pgmq import PgmqBus as Direct self.assertIs(network.PgmqBus, Direct) + @unittest.skipUnless(REDIS_AVAILABLE, "redis extra not installed") def test_redis_bus_lazy_import(self): """``RedisBus`` is resolved on first attribute access.""" from pipecat.bus.network.redis import RedisBus as Direct