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.

test(backend): disable pytest exception cleanup plugins (#89057)

Paul D'Ambra9700271bd5c0
diff --git a/pytest.ini b/pytest.ini
index 6807b49d9a84..cdf38029de49 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -18,7 +18,11 @@ junit_family = xunit1
# nothing in this repo uses the `faker` fixture or the library (faker is a transitive dep)
# -p pytest_boot_gc opens the boot GC window (gc.disable) before pytest-django runs
# django.setup(), which happens before conftest files load; the root conftest closes it
-addopts = -p no:warnings -p no:tach -p no:langsmith_plugin -p no:faker -p pytest_boot_gc --reuse-db --pytest-durations=0 --ignore=posthog/user_scripts --ignore=services/llm-gateway --ignore=services/stripe-mock --ignore=common/ingestion/acceptance_tests --ignore=tools/hogli --ignore=tools/hogli-commands --ignore=tools/owners --ignore=tools/traffic-sim --ignore=tools/query-performance-ai --ignore=products/desktop --ignore=products/stamphog/packages
+# -p no:unraisableexception -p no:threadexception: both plugins run gc_collect_harder()
+# (several full gc.collect passes over the whole heap, seconds per session at our heap sizes)
+# during cleanup to surface __del__/thread exceptions as warnings - but with -p no:warnings
+# those warnings can never escalate to failures here, so the collections are pure teardown cost
+addopts = -p no:warnings -p no:tach -p no:langsmith_plugin -p no:faker -p no:unraisableexception -p no:threadexception -p pytest_boot_gc --reuse-db --pytest-durations=0 --ignore=posthog/user_scripts --ignore=services/llm-gateway --ignore=services/stripe-mock --ignore=common/ingestion/acceptance_tests --ignore=tools/hogli --ignore=tools/hogli-commands --ignore=tools/owners --ignore=tools/traffic-sim --ignore=tools/query-performance-ai --ignore=products/desktop --ignore=products/stamphog/packages
markers =
ee