Commit d445359
authored
test: Deflake adaptive statistics and browser plugin tests on slow CI runners (#2203)
Two unit tests flake on the Windows CI shard under parallel load
([example
run](https://github.com/apify/crawlee-python/actions/runs/33367270395/job/99410412450)):
- `test_adaptive_crawling_statistics` asserts each adaptive counter
equals exactly 1, but when a slow Chromium launch pushes the browser
sub-crawl past the default 60s `request_handler_timeout`, `BasicCrawler`
retries the request - correct behavior - and every counter increments
again (`assert 2 == 1`). The test now passes a 5-minute
`request_handler_timeout`, removing the retry trigger while keeping the
exact-count assertions, so a real double-counting regression still fails
it.
- `test_new_browser` ran `page.goto` with Playwright's default 30s
timeout, which the first navigation on a saturated runner can exceed.
Raised to 60s, matching `test_browser_pool.py`.
Verified with deterministic fault injection: a 70s stall in
`BrowserPool.new_page` reproduced the exact CI failure before the fix
and 0/3 failures after; a 40s-slow server reproduced the `goto` timeout
with the default and passed with 60s. Plus 0/30 failures re-running both
modules under `pytest -n auto`. No production code is touched.
*✍️ Drafted by Claude Code*1 parent cc011e2 commit d445359
2 files changed
Lines changed: 4 additions & 1 deletion
File tree
- tests/unit
- browsers
- crawlers/_adaptive_playwright
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
495 | 498 | | |
496 | 499 | | |
497 | 500 | | |
| |||
0 commit comments