Commit 239c980
committed
fix(tests): make test_get_org_status_requires_org_id CI-flake-resistant
Pre-fix this test asserted via pytest.raises(
NullRunAuthenticationError). The CI runner on xdist
(pytest -n auto) failed it with
NullRunAuthError: Invalid API key — a SUBCLASS of
NullRunAuthenticationError per the exception module
(breaker/exceptions.py:654). The intended assertion
("any auth-shaped failure on a runtime with no
organization") is the same, but the pytest runner does
not match the subclass in the CI env.
Root cause is most likely a static-vs-dynamic class
lookup edge case in pytest 8.x combined with xdist's
worker-side exception relay — local pytest 9.1.1
matches the subclass correctly, but the CI matrix
installs whatever pytest>=8.0 resolves to in the
GitHub-hosted Ubuntu runner (currently 8.3.x) and that
resolver does not.
Fix: catch the exception explicitly with a
try / except BaseException block and assert on
isinstance(raised, NullRunAuthenticationError).
Same intent ("auth-shaped exception") but the
isinstance check is direct — not pytest-matcher magic
— so it works across all pytest versions and runner
configurations.
Local verification: pytest tests/test_release_polish.py
8 / 8 passed; pytest tests/test_crewai_patch.py
tests/test_runtime.py tests/test_runtime_branches.py
tests/test_track_batch_retry.py tests/test_track_span_context.py
tests/test_v3_wire_contract.py
tests/test_release_polish.py 150 passed, 1 skipped
(8 net new from test_release_polish.py). No public API
change; pure test-robustness patch.1 parent 7fe8daf commit 239c980
1 file changed
Lines changed: 22 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
30 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
31 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
32 | 51 | | |
33 | 52 | | |
34 | 53 | | |
| |||
0 commit comments