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.

chore(experiments): create discovery test data per test so reruns work (#124749)

Julian Bezf7fdc16d8fd7
diff --git a/products/experiments/backend/temporal/test_scheduled_recalculation_workflow.py b/products/experiments/backend/temporal/test_scheduled_recalculation_workflow.py
index 2c2fae8a060d..0415e5d6517c 100644
--- a/products/experiments/backend/temporal/test_scheduled_recalculation_workflow.py
+++ b/products/experiments/backend/temporal/test_scheduled_recalculation_workflow.py
@@ -269,6 +269,10 @@ async def test_discovery_failure_fails_the_workflow():
# an uncommitted test transaction.
@time_machine.travel("2026-09-15T02:30:00Z", tick=True)
class TestScheduledRecalculationWorkflowDiscovery(NonAtomicBaseTest):
+ # The flush after each test deletes the team and user, so a pytest rerun or a second
+ # test in this class needs them created again.
+ CLASS_DATA_LEVEL_SETUP = False
+
def _experiment(self, rollout_percentage: int) -> Experiment:
flag = FeatureFlag.objects.create(
team=self.team,