test: Mark test_http_status_statistics as flaky#1869
Merged
Conversation
Transient transport errors in macOS CI can consume the retry budget without reaching register_status_code, causing the exact-count assertion to fail (39 vs 40 for status 500). Reuses the existing flaky-rerun convention used elsewhere in the suite for CI-environment-induced flakes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1869 +/- ##
==========================================
+ Coverage 92.43% 92.49% +0.05%
==========================================
Files 158 158
Lines 11027 11027
==========================================
+ Hits 10193 10199 +6
+ Misses 834 828 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_http_status_statistics[httpx]failed intermittently on macOS Python 3.12 CI (example run) with'500': 39vs expected'500': 40.Each
status/500URL gets 4 attempts (1 initial + 3 retries frommax_request_retries=3). The httpx client only callsregister_status_codeafter a successful response (_httpx.py:175); a transient transport error (TCP reset / h2 stream hiccup, common on macOS-hosted runners under load) raises before that line, so the retry budget is consumed without bumping the counter — yielding 39 instead of 40.Production behavior is correct; only the test's exact-count assumption is fragile under CI network noise. Marking the test with
@pytest.mark.flaky(reruns=3, ...)follows the existing convention used for the same class of flake (e.g.test_basic_crawler.py:1376).