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(tasks): stop sandbox test errors leaking to error tracking (#70273)

posthog[bot]3781b0d63cd8
diff --git a/products/tasks/backend/logic/services/tests/conftest.py b/products/tasks/backend/logic/services/tests/conftest.py
new file mode 100644
index 000000000000..83340b5015b5
--- /dev/null
+++ b/products/tasks/backend/logic/services/tests/conftest.py
@@ -0,0 +1,13 @@
+import pytest
+from unittest.mock import patch
+
+
[email protected](autouse=True)
+def _no_error_tracking_capture():
+ # ProcessTaskError.__init__ calls capture_exception on construction, so any test that
+ # raises a sandbox/snapshot error would otherwise ship its fake exception to production
+ # error tracking whenever an api_key is configured (e.g. in CI). Stub it out for the whole
+ # package. Tests asserting on capture behavior patch this same target locally, which nests
+ # cleanly over the stub.
+ with patch("products.tasks.backend.exceptions.capture_exception"):
+ yield