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(async-deletion): scope test_delete_person count to its team (#73552)

Raúl Negrón-Otero14dc9b2d18ec
diff --git a/posthog/models/async_deletion/test_delete_person.py b/posthog/models/async_deletion/test_delete_person.py
index 0f0f38b5277a..9dc4788586b6 100644
--- a/posthog/models/async_deletion/test_delete_person.py
+++ b/posthog/models/async_deletion/test_delete_person.py
@@ -18,6 +18,8 @@ class TestDeletePerson(BaseTest, ClickhouseTestMixin):
remove_deleted_person_data(mutations_sync=True)
- count = sync_execute("SELECT count() FROM person")[0][0]
+ # Scope to this test's team: the ClickHouse person table is shared across the worker's
+ # tests and only truncated at package teardown, so a whole-table count sees other rows.
+ count = sync_execute("SELECT count() FROM person WHERE team_id = %(team_id)s", {"team_id": self.team.pk})[0][0]
assert count == 1