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(devex): stop the team fixture leaking a team onto PostHogTestCase (#106490)

Julian Bez87613427df23
diff --git a/posthog/conftest.py b/posthog/conftest.py
index 2cff99706956..3f2bca6a0163 100644
--- a/posthog/conftest.py
+++ b/posthog/conftest.py
@@ -507,7 +507,10 @@ TransactionTestCase._fixture_teardown = _patched_fixture_teardown # type: ignor
@pytest.fixture
def base_test_mixin_fixture():
- kls = PostHogTestCase()
+ # setUpTestData is a classmethod. On PostHogTestCase itself it would write the rows onto the
+ # shared base class, where a later test class that has not set up its own data yet reads a
+ # team this test already rolled back.
+ kls = type("BaseTestMixinFixture", (PostHogTestCase,), {})()
kls.setUp()
kls.setUpTestData()