: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(stamphog): fix flaky gate-denied wait test (#69718)
Alex Lider07a0e0f430b9
diff --git a/tools/pr-approval-agent/test_review_pr.py b/tools/pr-approval-agent/test_review_pr.pyindex 63ce30ad219a..93e05d8507cf 100644--- a/tools/pr-approval-agent/test_review_pr.py+++ b/tools/pr-approval-agent/test_review_pr.py@@ -1,6 +1,7 @@"""Tests for the review_pr.py output format."""import sys+from pathlib import Pathimport pytestfrom unittest.mock import MagicMock@@ -357,10 +358,15 @@ def test_title_flags_respect_exempt_paths(assert pipeline.classification["title_scrutiny_flags"] == expected_flags-def test_gate_denied_pr_skips_the_wait(monkeypatch: pytest.MonkeyPatch) -> None:+def test_gate_denied_pr_skips_the_wait(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:# A deny-listed PR can't be approved over an in-flight review, so waiting# 5 minutes before the inevitable REFUSE is pure runner cost.monkeypatch.setattr(review_pr, "_POSTHOG_AVAILABLE", False)+ # Stub the diff production: the review path would otherwise shell out to a real+ # `git diff` here, whose internal waiting trips the sleep trap below.+ diff_path = tmp_path / "diff.patch"+ diff_path.write_text("")+ monkeypatch.setattr(review_pr, "write_pr_diff", lambda *a, **k: diff_path)monkeypatch.setattr(review_pr.time, "sleep", lambda _s: pytest.fail("gate-denied PR must not wait"))class _RefusingReviewer: