Skip to content

test: fix flaky test_crawler_intermediate_statistics on Windows - #2265

Open
vdusek wants to merge 2 commits into
masterfrom
test/fix-flaky-intermediate-statistics
Open

vdusek wants to merge 2 commits into
masterfrom
test/fix-flaky-intermediate-statistics

Conversation

@vdusek

@vdusek vdusek commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

test_crawler_intermediate_statistics failed on Windows 3.12 (run) with 98582 µs >= 100000 µs. The test sleeps 100 ms with asyncio.sleep and expects crawler_runtime to be at least that long, but crawler_runtime comes from datetime.now(). On Windows before Python 3.13 that clock ticks every ~15.6 ms, and the only slack in the test was the poll lag, which can be close to zero.

The test now takes its own datetime.now() readings when it sees the crawler start and after the sleep, and asserts the runtime is at least the gap between them. Both sides use the same clock, and the check still fails if the runtime isn't updated while the crawler runs.

✍️ Drafted by Claude Code

@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Oct 1, 2026
@vdusek vdusek self-assigned this Oct 1, 2026
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.84%. Comparing base (c69f75f) to head (d9dc0d0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2265      +/-   ##
==========================================
- Coverage   93.88%   93.84%   -0.05%     
==========================================
  Files         182      182              
  Lines       13140    13140              
==========================================
- Hits        12337    12331       -6     
- Misses        803      809       +6     
Flag Coverage Δ
unit 93.84% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek requested a review from Pijukatel October 1, 2026 10:20
@vdusek
vdusek marked this pull request as ready for review October 1, 2026 10:20
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants