: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(batch-exports): reset activity db connections between api tests (#105973)
Raúl Negrón-Oteroaf80865c179b
diff --git a/products/batch_exports/backend/tests/api/conftest.py b/products/batch_exports/backend/tests/api/conftest.pyindex 0d28fcc09520..2f2bb7383dbc 100644--- a/products/batch_exports/backend/tests/api/conftest.py+++ b/products/batch_exports/backend/tests/api/conftest.py@@ -4,8 +4,9 @@ import pytestfrom unittest import mockfrom django.conf import settings+from django.db import connections-from asgiref.sync import async_to_sync+from asgiref.sync import SyncToAsync, async_to_syncfrom temporalio.client import (Client as TemporalClient,ScheduleDescription,@@ -75,6 +76,9 @@ def temporal_worker(temporal):@pytest.fixturedef cleanup(temporal):+ # Activities that outlive an earlier test can exit an atomic block while pytest-django blocks the database,+ # which leaves the activity thread's connection in a transaction that hides every later activity write.+ SyncToAsync.single_thread_executor.submit(connections.close_all).result()yieldcleanup_temporal_schedules(temporal)