Skip to content

Commit 3594a4c

Browse files
test: quarantine flaky live-provider tests (#2044)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
1 parent 29b9e11 commit 3594a4c

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎AGENTS.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ Minimum verification matrix:
102102

103103
- This suite uses real provider calls and runs as one dedicated CI suite. CI skips it on fork PRs, which have no provider secrets.
104104
- Any test that calls a model provider belongs here, never in `tests/e2e`, so fork PRs stay green on the e2e shards.
105+
106+
### Quarantine
107+
108+
- `QUARANTINED_NODEIDS` in `tests/conftest.py` lists tests that fail intermittently for reasons outside the SDK. They still run but are marked non-strict `xfail`, so CI reports XFAIL/XPASS instead of failing.
109+
- Quarantine only with evidence of flakiness, such as the same commit both passing and failing in CI. Do not quarantine deterministic failures.
110+
- Remove the entry once the cause is fixed.
105111
- Do not split or shard `tests/live_provider` into separate smoke and extended jobs unless the team explicitly changes that policy.
106112
- Keep assertions focused on stable provider-facing behavior rather than brittle observation counts.
107113

‎tests/conftest.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@
2222
"tests/e2e/test_media.py::test_replace_media_reference_string_in_object",
2323
}
2424

25+
# Tests that fail intermittently for reasons outside the SDK. They still run and
26+
# report XFAIL/XPASS, but cannot fail CI. Remove an entry once its cause is fixed.
27+
QUARANTINED_NODEIDS = {
28+
"tests/live_provider/test_openai.py::test_audio_input_and_output": (
29+
"flaky: OpenAI audio responses fail intermittently"
30+
),
31+
"tests/live_provider/test_openai.py::test_base_64_image_input": (
32+
"flaky: OpenAI image input fails intermittently"
33+
),
34+
"tests/live_provider/test_langchain.py::test_multimodal": (
35+
"flaky: OpenAI multimodal call intermittently hangs until timeout"
36+
),
37+
}
38+
# Signal-based so a hang raises inside the test and counts as XFAIL; the
39+
# suite's thread-based timeout kills the xdist worker instead.
40+
QUARANTINE_TIMEOUT_SECONDS = 60
41+
2542

2643
class InMemorySpanExporter(SpanExporter):
2744
"""Simple in-memory exporter to collect spans for deterministic tests."""
@@ -51,6 +68,13 @@ def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
5168
for item in items:
5269
test_group = Path(str(item.fspath)).parent.name
5370

71+
quarantine_reason = QUARANTINED_NODEIDS.get(item.nodeid)
72+
if quarantine_reason is not None:
73+
item.add_marker(pytest.mark.xfail(reason=quarantine_reason, strict=False))
74+
item.add_marker(
75+
pytest.mark.timeout(QUARANTINE_TIMEOUT_SECONDS, method="signal")
76+
)
77+
5478
if test_group == "unit":
5579
item.add_marker(pytest.mark.unit)
5680
continue

0 commit comments

Comments
 (0)