From c599acebbcc0e0093e2ea63120a6bd3662d080a4 Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Sun, 15 Mar 2026 13:12:58 -0700 Subject: [PATCH] Mocks the celery and Redis pings so we don't wait for their timeout each time --- src/documents/tests/test_api_status.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/documents/tests/test_api_status.py b/src/documents/tests/test_api_status.py index d2a092726..409f4bd7f 100644 --- a/src/documents/tests/test_api_status.py +++ b/src/documents/tests/test_api_status.py @@ -26,6 +26,23 @@ class TestSystemStatus(APITestCase): self.override = override_settings(MEDIA_ROOT=self.tmp_dir) self.override.enable() + # Mock slow network calls so tests don't block on real Redis/Celery timeouts. + # Individual tests that care about specific behaviour override these with + # their own @mock.patch decorators (which take precedence). + redis_patcher = mock.patch( + "redis.Redis.execute_command", + side_effect=Exception("Redis not available"), + ) + self.mock_redis = redis_patcher.start() + self.addCleanup(redis_patcher.stop) + + celery_patcher = mock.patch( + "celery.app.control.Inspect.ping", + side_effect=Exception("Celery not available"), + ) + self.mock_celery_ping = celery_patcher.start() + self.addCleanup(celery_patcher.stop) + def tearDown(self) -> None: super().tearDown()