Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(warehouse-sources): stop terminalize unit tests tripping the db blocker (#79466)

Joe Martinedc31015ba55
diff --git a/posthog/temporal/tests/warehouse_sources_queue_partition_management/test_activities.py b/posthog/temporal/tests/warehouse_sources_queue_partition_management/test_activities.py
index 5e3dd8760bf4..a94140357d90 100644
--- a/posthog/temporal/tests/warehouse_sources_queue_partition_management/test_activities.py
+++ b/posthog/temporal/tests/warehouse_sources_queue_partition_management/test_activities.py
@@ -393,6 +393,9 @@ class _StrandedQueryConn:
@contextmanager
def _patched_terminalize_collaborators():
with (
+ # These tests run without the django_db mark, but close_old_connections probes any
+ # connection a neighboring test left initialized, tripping pytest-django's DB blocker.
+ patch("django.db.close_old_connections"),
patch("products.warehouse_sources.backend.facade.pipelines.BatchQueue") as batch_queue,
patch("products.warehouse_sources.backend.facade.pipelines.mark_job_failed_if_not_terminal") as mark_failed,
patch("products.warehouse_sources.backend.facade.pipelines.release_v3_pipeline_lock") as release_lock,