: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
test(batch-exports): Move batch export API tests (#61736)
Rossce5def3b7907
diff --git a/posthog/api/test/test_team.py b/posthog/api/test/test_team.pyindex 5c0dd7559372..4fce2b39fb4a 100644--- a/posthog/api/test/test_team.py+++ b/posthog/api/test/test_team.py@@ -25,7 +25,6 @@ from posthog.api.team import (_default_data_color_theme_id,_reset_default_data_color_theme_id_cache,)-from posthog.api.test.batch_exports.conftest import start_test_workerfrom posthog.constants import AvailableFeaturefrom posthog.models import ActivityLogfrom posthog.models.group_type_mapping import (@@ -44,9 +43,11 @@ from posthog.models.user import Userfrom posthog.models.utils import generate_random_token_personal, hash_key_valuefrom posthog.temporal.common.client import sync_connectfrom posthog.temporal.common.schedule import describe_schedule+from posthog.temporal.common.test_utils import start_test_workerfrom posthog.test.test_utils import create_group_type_mapping_without_created_atfrom posthog.utils import get_instance_realm+from products.batch_exports.backend.temporal import ACTIVITIES, WORKFLOWSfrom products.dashboards.backend.models.dashboard import Dashboardfrom products.early_access_features.backend.models import EarlyAccessFeature@@ -628,7 +629,12 @@ def team_api_test_factory():temporal = sync_connect()- with start_test_worker(temporal):+ with start_test_worker(+ temporal,+ task_queue=settings.BATCH_EXPORTS_TASK_QUEUE,+ workflows=WORKFLOWS,+ activities=ACTIVITIES,+ ):response = self.client.post(f"/api/environments/{team.id}/batch_exports",json.dumps(batch_export_data),@@ -674,7 +680,12 @@ def team_api_test_factory():temporal = sync_connect()- with start_test_worker(temporal):+ with start_test_worker(+ temporal,+ task_queue=settings.BATCH_EXPORTS_TASK_QUEUE,+ workflows=WORKFLOWS,+ activities=ACTIVITIES,+ ):response = self.client.post(f"/api/environments/{team.id}/batch_exports",json.dumps(batch_export_data),diff --git a/posthog/management/commands/test/test_backfill_batch_export_runs.py b/posthog/management/commands/test/test_backfill_batch_export_runs.pyindex c3292b9ff253..c42ce9a12264 100644--- a/posthog/management/commands/test/test_backfill_batch_export_runs.py+++ b/posthog/management/commands/test/test_backfill_batch_export_runs.py@@ -7,19 +7,21 @@ from zoneinfo import ZoneInfoimport pytestfrom freezegun import freeze_time+from django.conf import settingsfrom django.core.management import call_commandfrom django.utils import timezonefrom asgiref.sync import async_to_syncfrom temporalio.service import RPCError-from posthog.api.test.batch_exports.operations import start_test_workerfrom posthog.management.commands.backfill_batch_export_runs import find_missing_intervals, get_batch_exportsfrom posthog.models import Organization, Teamfrom posthog.temporal.common.client import sync_connect+from posthog.temporal.common.test_utils import start_test_workerfrom posthog.temporal.tests.utils.models import create_batch_exportfrom products.batch_exports.backend.models.batch_export import BatchExport, BatchExportDestination, BatchExportRun+from products.batch_exports.backend.temporal import ACTIVITIES, WORKFLOWSfrom products.batch_exports.backend.tests.temporal.backfills.conftest import wait_for_workflows@@ -414,7 +416,12 @@ class TestBackfillCommand:Uses class scoped fixture to save time (stopping the worker takes a while)."""- with start_test_worker(temporal_client):+ with start_test_worker(+ temporal_client,+ task_queue=settings.BATCH_EXPORTS_TASK_QUEUE,+ workflows=WORKFLOWS,+ activities=ACTIVITIES,+ ):yield temporal_client@pytest.fixturediff --git a/posthog/temporal/common/test_utils.py b/posthog/temporal/common/test_utils.pynew file mode 100644index 000000000000..339f7d359de2--- /dev/null+++ b/posthog/temporal/common/test_utils.py@@ -0,0 +1,70 @@+import time+import asyncio+import datetime as dt+import threading+from collections.abc import Callable, Sequence+from contextlib import contextmanager++import temporalio.worker+from temporalio.client import Client as TemporalClient+from temporalio.worker import Worker+++class ThreadedWorker(Worker):+ """A Temporal Worker that can run in a separate thread.++ Intended to be used in sync tests that require a Temporal Worker.+ """++ @contextmanager+ def run_in_thread(self):+ """Run a Temporal Worker in a thread.++ Don't use this outside of tests. Once PostHog is fully async we can get rid of this.+ """+ loop = asyncio.new_event_loop()+ t = threading.Thread(target=self.run_using_loop, daemon=True, args=(loop,))+ t.start()++ try:+ while not self.is_running:+ time.sleep(0.1)+ yield+ finally:+ self._shutdown_event.set()+ # Give the worker a chance to shut down before exiting+ max_wait = 10.0+ while t.is_alive() and max_wait > 0:+ time.sleep(0.1)+ max_wait -= 0.1++ def run_using_loop(self, loop):+ """Setup an event loop to run the Worker.++ Using async_to_sync(Worker.run) causes a deadlock.+ """+ asyncio.set_event_loop(loop)+ try:+ loop.run_until_complete(super().run())+ finally:+ loop.run_until_complete(loop.shutdown_asyncgens())+ loop.close()+++@contextmanager+def start_test_worker(+ temporal: TemporalClient,+ *,+ task_queue: str,+ workflows: Sequence[type],+ activities: Sequence[Callable],+):+ with ThreadedWorker(+ client=temporal,+ task_queue=task_queue,+ workflows=workflows,+ activities=activities,+ workflow_runner=temporalio.worker.UnsandboxedWorkflowRunner(),+ graceful_shutdown_timeout=dt.timedelta(seconds=5),+ ).run_in_thread():+ yielddiff --git a/posthog/api/test/batch_exports/__init__.py b/products/batch_exports/backend/tests/api/backfills/__init__.pysimilarity index 100%rename from posthog/api/test/batch_exports/__init__.pyrename to products/batch_exports/backend/tests/api/backfills/__init__.pydiff --git a/posthog/api/test/batch_exports/backfills/test_cancel.py b/products/batch_exports/backend/tests/api/backfills/test_cancel.pysimilarity index 98%rename from posthog/api/test/batch_exports/backfills/test_cancel.pyrename to products/batch_exports/backend/tests/api/backfills/test_cancel.pyindex c322997f8869..c805854b2408 100644--- a/posthog/api/test/batch_exports/backfills/test_cancel.py+++ b/products/batch_exports/backend/tests/api/backfills/test_cancel.py@@ -8,7 +8,8 @@ from unittest.mock import patchfrom django.test.client import Client as HttpClient-from posthog.api.test.batch_exports.operations import (+from products.batch_exports.backend.models.batch_export import BatchExportRun+from products.batch_exports.backend.tests.api.operations import (backfill_batch_export_ok,cancel_batch_export_backfill_ok,create_batch_export_ok,@@ -16,8 +17,6 @@ from posthog.api.test.batch_exports.operations import (list_batch_export_backfills_ok,)-from products.batch_exports.backend.models.batch_export import BatchExportRun-pytestmark = [pytest.mark.usefixtures("temporal_worker", "cleanup"),]diff --git a/posthog/api/test/batch_exports/backfills/test_create.py b/products/batch_exports/backend/tests/api/backfills/test_create.pysimilarity index 99%rename from posthog/api/test/batch_exports/backfills/test_create.pyrename to products/batch_exports/backend/tests/api/backfills/test_create.pyindex 8d14b973c7c5..152efd26c514 100644--- a/posthog/api/test/batch_exports/backfills/test_create.py+++ b/products/batch_exports/backend/tests/api/backfills/test_create.py@@ -9,14 +9,14 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.fixtures import create_organization-from posthog.api.test.batch_exports.operations import backfill_batch_export, create_batch_export_okfrom posthog.api.test.test_team import create_teamfrom posthog.api.test.test_user import create_userfrom posthog.models.person.util import create_personfrom posthog.models.team import Teamfrom products.batch_exports.backend.models.batch_export import BatchExport, BatchExportBackfill+from products.batch_exports.backend.tests.api.fixtures import create_organization+from products.batch_exports.backend.tests.api.operations import backfill_batch_export, create_batch_export_okpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/backfills/test_get.py b/products/batch_exports/backend/tests/api/backfills/test_get.pysimilarity index 96%rename from posthog/api/test/batch_exports/backfills/test_get.pyrename to products/batch_exports/backend/tests/api/backfills/test_get.pyindex 323b908ba5a3..8d4f022caf97 100644--- a/posthog/api/test/batch_exports/backfills/test_get.py+++ b/products/batch_exports/backend/tests/api/backfills/test_get.py@@ -6,10 +6,14 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.fixtures import create_backfill, create_batch_export, create_destination, create_run-from posthog.api.test.batch_exports.operations import get_batch_export_backfill_ok-from products.batch_exports.backend.models.batch_export import BatchExportBackfill, BatchExportRun+from products.batch_exports.backend.tests.api.fixtures import (+ create_backfill,+ create_batch_export,+ create_destination,+ create_run,+)+from products.batch_exports.backend.tests.api.operations import get_batch_export_backfill_okpytestmark = [pytest.mark.django_db,@@ -179,9 +183,10 @@ def test_can_get_backfills_for_your_organizations(def test_cannot_get_backfills_for_other_organizations(client: HttpClient, organization, team):- from posthog.api.test.batch_exports.fixtures import create_organizationfrom posthog.api.test.test_user import create_user+ from products.batch_exports.backend.tests.api.fixtures import create_organization+destination = create_destination()batch_export = create_batch_export(team, destination)backfill = create_backfill(diff --git a/posthog/api/test/batch_exports/backfills/test_list.py b/products/batch_exports/backend/tests/api/backfills/test_list.pysimilarity index 93%rename from posthog/api/test/batch_exports/backfills/test_list.pyrename to products/batch_exports/backend/tests/api/backfills/test_list.pyindex 972ed71ba3c2..15eba685c0a9 100644--- a/posthog/api/test/batch_exports/backfills/test_list.py+++ b/products/batch_exports/backend/tests/api/backfills/test_list.py@@ -4,10 +4,9 @@ import pytestfrom django.test.client import Client as HttpClient-from posthog.api.test.batch_exports.fixtures import create_backfill, create_batch_export, create_destination-from posthog.api.test.batch_exports.operations import list_batch_export_backfills_ok-from products.batch_exports.backend.models.batch_export import BatchExportBackfill+from products.batch_exports.backend.tests.api.fixtures import create_backfill, create_batch_export, create_destination+from products.batch_exports.backend.tests.api.operations import list_batch_export_backfills_okpytestmark = [pytest.mark.django_db]@@ -61,10 +60,11 @@ def test_cannot_list_batch_export_backfills_for_other_organizations(client: Httpdt.datetime(2025, 1, 1, 1, 0, 0, tzinfo=dt.UTC),)- from posthog.api.test.batch_exports.fixtures import create_organizationfrom posthog.api.test.test_team import create_teamfrom posthog.api.test.test_user import create_user+ from products.batch_exports.backend.tests.api.fixtures import create_organization+other_organization = create_organization("Other Test Org")other_team = create_team(other_organization)other_user = create_user("[email protected]", "Another Test User", other_organization)diff --git a/posthog/api/test/batch_exports/backfills/test_read_only.py b/products/batch_exports/backend/tests/api/backfills/test_read_only.pysimilarity index 94%rename from posthog/api/test/batch_exports/backfills/test_read_only.pyrename to products/batch_exports/backend/tests/api/backfills/test_read_only.pyindex a64826859e1e..4b36bebc1ebf 100644--- a/posthog/api/test/batch_exports/backfills/test_read_only.py+++ b/products/batch_exports/backend/tests/api/backfills/test_read_only.py@@ -6,9 +6,8 @@ from django.test.client import Client as TestClientfrom rest_framework import status-from posthog.api.test.batch_exports.fixtures import create_backfill, create_batch_export, create_destination-from products.batch_exports.backend.models.batch_export import BatchExportBackfill+from products.batch_exports.backend.tests.api.fixtures import create_backfill, create_batch_export, create_destinationpytestmark = [pytest.mark.django_db]diff --git a/posthog/api/test/batch_exports/conftest.py b/products/batch_exports/backend/tests/api/conftest.pysimilarity index 95%rename from posthog/api/test/batch_exports/conftest.pyrename to products/batch_exports/backend/tests/api/conftest.pyindex c71c0cee063d..48b56da9165d 100644--- a/posthog/api/test/batch_exports/conftest.py+++ b/products/batch_exports/backend/tests/api/conftest.py@@ -12,12 +12,12 @@ from temporalio.client import ()from temporalio.service import RPCError-from posthog.api.test.batch_exports.fixtures import create_organization, create_team, create_user-from posthog.api.test.batch_exports.operations import start_test_workerfrom posthog.temporal.common.client import sync_connectfrom posthog.temporal.common.codec import EncryptionCodecfrom products.batch_exports.backend.models.batch_export import BATCH_EXPORT_INTERVAL_TO_START_JITTER, BatchExport+from products.batch_exports.backend.tests.api.fixtures import create_organization, create_team, create_user+from products.batch_exports.backend.tests.api.operations import start_test_worker@async_to_syncdiff --git a/posthog/api/test/batch_exports/fixtures.py b/products/batch_exports/backend/tests/api/fixtures.pysimilarity index 100%rename from posthog/api/test/batch_exports/fixtures.pyrename to products/batch_exports/backend/tests/api/fixtures.pydiff --git a/posthog/api/test/batch_exports/operations.py b/products/batch_exports/backend/tests/api/operations.pysimilarity index 83%rename from posthog/api/test/batch_exports/operations.pyrename to products/batch_exports/backend/tests/api/operations.pyindex 7a57f1ad2de2..4142a9a46959 100644--- a/posthog/api/test/batch_exports/operations.py+++ b/products/batch_exports/backend/tests/api/operations.py@@ -1,75 +1,28 @@-import timeimport asyncio-import datetime as dt-import threadingfrom contextlib import contextmanagerfrom django.conf import settingsfrom django.test.client import Client as TestClientimport temporalio.client-import temporalio.workerfrom asgiref.sync import async_to_syncfrom rest_framework import statusfrom temporalio.client import Client as TemporalClient-from temporalio.worker import Workerfrom posthog.models.utils import UUIDT+from posthog.temporal.common.test_utils import start_test_worker as start_threaded_workerfrom products.batch_exports.backend.temporal import ACTIVITIES, WORKFLOWS-class ThreadedWorker(Worker):- """A Temporal Worker that can run in a separate thread.-- Inteded to be used in sync tests that require a Temporal Worker.- """-- @contextmanager- def run_in_thread(self):- """Run a Temporal Worker in a thread.-- Don't use this outside of tests. Once PostHog is fully async we can get rid of this.- """- loop = asyncio.new_event_loop()- t = threading.Thread(target=self.run_using_loop, daemon=True, args=(loop,))- t.start()-- try:- while not self.is_running:- time.sleep(0.1)- yield- finally:- self._shutdown_event.set()- # Give the worker a chance to shut down before exiting- max_wait = 10.0- while t.is_alive() and max_wait > 0:- time.sleep(0.1)- max_wait -= 0.1-- def run_using_loop(self, loop):- """Setup an event loop to run the Worker.-- Using async_to_sync(Worker.run) causes a deadlock.- """- asyncio.set_event_loop(loop)- try:- loop.run_until_complete(super().run())- finally:- loop.run_until_complete(loop.shutdown_asyncgens())- loop.close()--@contextmanagerdef start_test_worker(temporal: TemporalClient):- with ThreadedWorker(- client=temporal,+ with start_threaded_worker(+ temporal,task_queue=settings.BATCH_EXPORTS_TASK_QUEUE,workflows=WORKFLOWS,activities=ACTIVITIES,- workflow_runner=temporalio.worker.UnsandboxedWorkflowRunner(),- graceful_shutdown_timeout=dt.timedelta(seconds=5),- ).run_in_thread():+ ):yielddiff --git a/posthog/api/test/batch_exports/test_create.py b/products/batch_exports/backend/tests/api/test_create.pysimilarity index 99%rename from posthog/api/test/batch_exports/test_create.pyrename to products/batch_exports/backend/tests/api/test_create.pyindex 83e41d6d0043..364cae4afe50 100644--- a/posthog/api/test/batch_exports/test_create.py+++ b/products/batch_exports/backend/tests/api/test_create.py@@ -12,17 +12,17 @@ from django.test.client import Client as HttpClientfrom asgiref.sync import async_to_syncfrom rest_framework import status-from posthog.api.test.batch_exports.conftest import (- assert_is_daily_schedule,- assert_is_weekly_schedule,- describe_schedule,-)-from posthog.api.test.batch_exports.fixtures import create_organization-from posthog.api.test.batch_exports.operations import create_batch_exportfrom posthog.api.test.test_team import create_teamfrom posthog.api.test.test_user import create_userfrom products.batch_exports.backend.models.batch_export import BatchExport+from products.batch_exports.backend.tests.api.conftest import (+ assert_is_daily_schedule,+ assert_is_weekly_schedule,+ describe_schedule,+)+from products.batch_exports.backend.tests.api.fixtures import create_organization+from products.batch_exports.backend.tests.api.operations import create_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_create_azure_blob.py b/products/batch_exports/backend/tests/api/test_create_azure_blob.pysimilarity index 93%rename from posthog/api/test/batch_exports/test_create_azure_blob.pyrename to products/batch_exports/backend/tests/api/test_create_azure_blob.pyindex 6415632c3427..1f1245d093fa 100644--- a/posthog/api/test/batch_exports/test_create_azure_blob.py+++ b/products/batch_exports/backend/tests/api/test_create_azure_blob.py@@ -5,10 +5,11 @@ from django.test.client import Client as HttpClientfrom rest_framework import statusfrom temporalio.client import ScheduleActionStartWorkflow-from posthog.api.test.batch_exports.conftest import describe_schedule-from posthog.api.test.batch_exports.operations import create_batch_exportfrom posthog.models.integration import Integration+from products.batch_exports.backend.tests.api.conftest import describe_schedule+from products.batch_exports.backend.tests.api.operations import create_batch_export+pytestmark = [pytest.mark.django_db,pytest.mark.usefixtures("temporal_worker", "cleanup"),diff --git a/posthog/api/test/batch_exports/test_create_databricks.py b/products/batch_exports/backend/tests/api/test_create_databricks.pysimilarity index 97%rename from posthog/api/test/batch_exports/test_create_databricks.pyrename to products/batch_exports/backend/tests/api/test_create_databricks.pyindex 3e29e33d4086..ca764f56d138 100644--- a/posthog/api/test/batch_exports/test_create_databricks.py+++ b/products/batch_exports/backend/tests/api/test_create_databricks.py@@ -7,10 +7,11 @@ from django.test.client import Client as HttpClientfrom rest_framework import statusfrom temporalio.client import ScheduleActionStartWorkflow-from posthog.api.test.batch_exports.conftest import describe_schedule-from posthog.api.test.batch_exports.operations import create_batch_exportfrom posthog.models.integration import Integration+from products.batch_exports.backend.tests.api.conftest import describe_schedule+from products.batch_exports.backend.tests.api.operations import create_batch_export+pytestmark = [pytest.mark.django_db,pytest.mark.usefixtures("temporal_worker", "cleanup"),diff --git a/posthog/api/test/batch_exports/test_create_http.py b/products/batch_exports/backend/tests/api/test_create_http.pysimilarity index 94%rename from posthog/api/test/batch_exports/test_create_http.pyrename to products/batch_exports/backend/tests/api/test_create_http.pyindex 45143bbcaee8..85dc3a4f2893 100644--- a/posthog/api/test/batch_exports/test_create_http.py+++ b/products/batch_exports/backend/tests/api/test_create_http.py@@ -4,7 +4,7 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export+from products.batch_exports.backend.tests.api.operations import create_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_create_redshift.py b/products/batch_exports/backend/tests/api/test_create_redshift.pysimilarity index 98%rename from posthog/api/test/batch_exports/test_create_redshift.pyrename to products/batch_exports/backend/tests/api/test_create_redshift.pyindex 62ce3b59501c..2bca2e211d7e 100644--- a/posthog/api/test/batch_exports/test_create_redshift.py+++ b/products/batch_exports/backend/tests/api/test_create_redshift.py@@ -4,7 +4,7 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export+from products.batch_exports.backend.tests.api.operations import create_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_create_s3.py b/products/batch_exports/backend/tests/api/test_create_s3.pysimilarity index 99%rename from posthog/api/test/batch_exports/test_create_s3.pyrename to products/batch_exports/backend/tests/api/test_create_s3.pyindex ef62fa07da5d..45d57be72488 100644--- a/posthog/api/test/batch_exports/test_create_s3.py+++ b/products/batch_exports/backend/tests/api/test_create_s3.py@@ -7,9 +7,8 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export-from products.batch_exports.backend.models.batch_export import S3_FAMILY_TYPES+from products.batch_exports.backend.tests.api.operations import create_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_create_snowflake.py b/products/batch_exports/backend/tests/api/test_create_snowflake.pysimilarity index 96%rename from posthog/api/test/batch_exports/test_create_snowflake.pyrename to products/batch_exports/backend/tests/api/test_create_snowflake.pyindex 613ff5197799..011c4bd618cf 100644--- a/posthog/api/test/batch_exports/test_create_snowflake.py+++ b/products/batch_exports/backend/tests/api/test_create_snowflake.py@@ -4,7 +4,7 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export+from products.batch_exports.backend.tests.api.operations import create_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_create_workflows.py b/products/batch_exports/backend/tests/api/test_create_workflows.pysimilarity index 93%rename from posthog/api/test/batch_exports/test_create_workflows.pyrename to products/batch_exports/backend/tests/api/test_create_workflows.pyindex b29fc3338c40..b7e7c78124af 100644--- a/posthog/api/test/batch_exports/test_create_workflows.py+++ b/products/batch_exports/backend/tests/api/test_create_workflows.py@@ -5,8 +5,8 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.conftest import assert_is_daily_schedule, describe_schedule-from posthog.api.test.batch_exports.operations import create_batch_export+from products.batch_exports.backend.tests.api.conftest import assert_is_daily_schedule, describe_schedule+from products.batch_exports.backend.tests.api.operations import create_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_delete.py b/products/batch_exports/backend/tests/api/test_delete.pysimilarity index 98%rename from posthog/api/test/batch_exports/test_delete.pyrename to products/batch_exports/backend/tests/api/test_delete.pyindex f9b12f1309d7..4b90744bf52d 100644--- a/posthog/api/test/batch_exports/test_delete.py+++ b/products/batch_exports/backend/tests/api/test_delete.py@@ -11,8 +11,12 @@ from asgiref.sync import async_to_syncfrom rest_framework import statusfrom temporalio.service import RPCError-from posthog.api.test.batch_exports.fixtures import create_organization-from posthog.api.test.batch_exports.operations import (+from posthog.api.test.test_team import create_team+from posthog.api.test.test_user import create_user+from posthog.temporal.common.schedule import describe_schedule++from products.batch_exports.backend.tests.api.fixtures import create_organization+from products.batch_exports.backend.tests.api.operations import (backfill_batch_export_ok,create_batch_export_ok,delete_batch_export,@@ -20,9 +24,6 @@ from posthog.api.test.batch_exports.operations import (get_batch_export,wait_for_workflow_executions,)-from posthog.api.test.test_team import create_team-from posthog.api.test.test_user import create_user-from posthog.temporal.common.schedule import describe_schedulepytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_get.py b/products/batch_exports/backend/tests/api/test_get.pysimilarity index 96%rename from posthog/api/test/batch_exports/test_get.pyrename to products/batch_exports/backend/tests/api/test_get.pyindex 581932a58994..dfffc260319d 100644--- a/posthog/api/test/batch_exports/test_get.py+++ b/products/batch_exports/backend/tests/api/test_get.py@@ -4,11 +4,12 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.fixtures import create_organization-from posthog.api.test.batch_exports.operations import create_batch_export_ok, get_batch_exportfrom posthog.api.test.test_team import create_teamfrom posthog.api.test.test_user import create_user+from products.batch_exports.backend.tests.api.fixtures import create_organization+from products.batch_exports.backend.tests.api.operations import create_batch_export_ok, get_batch_export+pytestmark = [pytest.mark.django_db,pytest.mark.usefixtures("temporal_worker", "cleanup"),diff --git a/posthog/api/test/batch_exports/test_list.py b/products/batch_exports/backend/tests/api/test_list.pysimilarity index 97%rename from posthog/api/test/batch_exports/test_list.pyrename to products/batch_exports/backend/tests/api/test_list.pyindex 2e2dd1e7e359..e1ef4e41ca62 100644--- a/posthog/api/test/batch_exports/test_list.py+++ b/products/batch_exports/backend/tests/api/test_list.py@@ -3,14 +3,15 @@ from unittest import mockfrom django.test.client import Client as HttpClient-from posthog.api.test.batch_exports.fixtures import create_organization-from posthog.api.test.batch_exports.operations import (+from posthog.api.test.test_team import create_team+from posthog.api.test.test_user import create_user++from products.batch_exports.backend.tests.api.fixtures import create_organization+from products.batch_exports.backend.tests.api.operations import (create_batch_export_ok,delete_batch_export_ok,list_batch_exports_ok,)-from posthog.api.test.test_team import create_team-from posthog.api.test.test_user import create_userpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_pause.py b/products/batch_exports/backend/tests/api/test_pause.pysimilarity index 98%rename from posthog/api/test/batch_exports/test_pause.pyrename to products/batch_exports/backend/tests/api/test_pause.pyindex 1a0b42dd89c3..f5c235d93982 100644--- a/posthog/api/test/batch_exports/test_pause.py+++ b/products/batch_exports/backend/tests/api/test_pause.py@@ -7,7 +7,10 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import (+from posthog.temporal.common.schedule import describe_schedule++from products.batch_exports.backend.service import batch_export_delete_schedule+from products.batch_exports.backend.tests.api.operations import (create_batch_export_ok,get_batch_export_ok,pause_batch_export,@@ -15,9 +18,6 @@ from posthog.api.test.batch_exports.operations import (unpause_batch_export,unpause_batch_export_ok,)-from posthog.temporal.common.schedule import describe_schedule--from products.batch_exports.backend.service import batch_export_delete_schedulepytestmark = [pytest.mark.django_db,@@ -94,10 +94,11 @@ def test_cannot_pause_and_unpause_batch_exports_of_other_organizations("interval": "hour",}- from posthog.api.test.batch_exports.fixtures import create_organizationfrom posthog.api.test.test_team import create_teamfrom posthog.api.test.test_user import create_user+ from products.batch_exports.backend.tests.api.fixtures import create_organization+other_organization = create_organization("Other Test Org")create_team(other_organization)other_user = create_user("[email protected]", "Another Test User", other_organization)diff --git a/posthog/api/test/batch_exports/test_runs.py b/products/batch_exports/backend/tests/api/test_runs.pysimilarity index 97%rename from posthog/api/test/batch_exports/test_runs.pyrename to products/batch_exports/backend/tests/api/test_runs.pyindex 7fab3307b1e6..fe810b6c1c1c 100644--- a/posthog/api/test/batch_exports/test_runs.py+++ b/products/batch_exports/backend/tests/api/test_runs.py@@ -9,8 +9,8 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.fixtures import create_organization, create_team, create_user-from posthog.api.test.batch_exports.operations import (+from products.batch_exports.backend.tests.api.fixtures import create_organization, create_team, create_user+from products.batch_exports.backend.tests.api.operations import (backfill_batch_export_ok,cancel_batch_export_run_ok,create_batch_export_ok,diff --git a/posthog/api/test/batch_exports/test_serializers.py b/products/batch_exports/backend/tests/api/test_serializers.pysimilarity index 100%rename from posthog/api/test/batch_exports/test_serializers.pyrename to products/batch_exports/backend/tests/api/test_serializers.pydiff --git a/posthog/api/test/batch_exports/test_test.py b/products/batch_exports/backend/tests/api/test_test.pysimilarity index 99%rename from posthog/api/test/batch_exports/test_test.pyrename to products/batch_exports/backend/tests/api/test_test.pyindex ddf3fdfe489d..46cd826423e2 100644--- a/posthog/api/test/batch_exports/test_test.py+++ b/products/batch_exports/backend/tests/api/test_test.py@@ -12,7 +12,6 @@ import aioboto3import pytest_asynciofrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export_okfrom posthog.models import Integrationfrom products.batch_exports.backend.api.destination_tests.base import DestinationTestStepResult, Status@@ -23,6 +22,7 @@ from products.batch_exports.backend.api.destination_tests.databricks import ()from products.batch_exports.backend.api.destination_tests.snowflake import SnowflakeEstablishConnectionTestStepfrom products.batch_exports.backend.models.batch_export import BatchExportDestination+from products.batch_exports.backend.tests.api.operations import create_batch_export_okpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_update.py b/products/batch_exports/backend/tests/api/test_update.pysimilarity index 99%rename from posthog/api/test/batch_exports/test_update.pyrename to products/batch_exports/backend/tests/api/test_update.pyindex e79258088c1d..0e760af661bb 100644--- a/posthog/api/test/batch_exports/test_update.py+++ b/products/batch_exports/backend/tests/api/test_update.py@@ -9,21 +9,21 @@ from django.test.client import Client as HttpClientfrom asgiref.sync import async_to_syncfrom rest_framework import status-from posthog.api.test.batch_exports.conftest import (+from posthog.models.integration import Integration++from products.batch_exports.backend.models.batch_export import BatchExport, BatchExportDestination+from products.batch_exports.backend.service import sync_batch_export+from products.batch_exports.backend.tests.api.conftest import (assert_is_daily_schedule,assert_is_weekly_schedule,describe_schedule,)-from posthog.api.test.batch_exports.operations import (+from products.batch_exports.backend.tests.api.operations import (create_batch_export_ok,get_batch_export_ok,patch_batch_export,put_batch_export,)-from posthog.models.integration import Integration--from products.batch_exports.backend.models.batch_export import BatchExport, BatchExportDestination-from products.batch_exports.backend.service import sync_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_update_redshift.py b/products/batch_exports/backend/tests/api/test_update_redshift.pysimilarity index 93%rename from posthog/api/test/batch_exports/test_update_redshift.pyrename to products/batch_exports/backend/tests/api/test_update_redshift.pyindex 15e9af63479d..bd6057925017 100644--- a/posthog/api/test/batch_exports/test_update_redshift.py+++ b/products/batch_exports/backend/tests/api/test_update_redshift.py@@ -4,7 +4,11 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export_ok, get_batch_export_ok, patch_batch_export+from products.batch_exports.backend.tests.api.operations import (+ create_batch_export_ok,+ get_batch_export_ok,+ patch_batch_export,+)pytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_update_s3.py b/products/batch_exports/backend/tests/api/test_update_s3.pysimilarity index 94%rename from posthog/api/test/batch_exports/test_update_s3.pyrename to products/batch_exports/backend/tests/api/test_update_s3.pyindex 675df821992b..74c1d59db5e1 100644--- a/posthog/api/test/batch_exports/test_update_s3.py+++ b/products/batch_exports/backend/tests/api/test_update_s3.py@@ -4,9 +4,8 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export_ok, patch_batch_export-from products.batch_exports.backend.models.batch_export import S3_FAMILY_TYPES+from products.batch_exports.backend.tests.api.operations import create_batch_export_ok, patch_batch_exportpytestmark = [pytest.mark.django_db,diff --git a/posthog/api/test/batch_exports/test_update_snowflake.py b/products/batch_exports/backend/tests/api/test_update_snowflake.pysimilarity index 97%rename from posthog/api/test/batch_exports/test_update_snowflake.pyrename to products/batch_exports/backend/tests/api/test_update_snowflake.pyindex 59e43691139f..ef6968aaa270 100644--- a/posthog/api/test/batch_exports/test_update_snowflake.py+++ b/products/batch_exports/backend/tests/api/test_update_snowflake.py@@ -4,7 +4,11 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from posthog.api.test.batch_exports.operations import create_batch_export_ok, get_batch_export_ok, patch_batch_export+from products.batch_exports.backend.tests.api.operations import (+ create_batch_export_ok,+ get_batch_export_ok,+ patch_batch_export,+)pytestmark = [pytest.mark.django_db,