Repository navigation
Commit b2bafde
authored
test: Fix flaky worker-thread source close test (#1108)
`test_generator_source_pulled_in_a_worker_thread_is_closed_once_its_chunk_arrives`
failed on Windows in [this
run](https://github.com/apify/apify-client-python/actions/runs/37745280813/job/113205183441).
The test started the puller thread and returned the 408 right away. If
the thread had not entered the generator yet, `close_chunks()` closed
the idle generator at once, so the source was closed before the test
released it.
The source now sets an event just before it blocks, and the fake
transport waits for it before responding. The attempt always ends while
the worker thread is inside the source. Delaying every thread start by
50 ms reproduced the failure 20/20 before the change and 0/100 after.
*✍️ Drafted by Claude Code*1 parent 2397de6 commit b2bafde
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1542 | 1542 | | |
1543 | 1543 | | |
1544 | 1544 | | |
| 1545 | + | |
1545 | 1546 | | |
1546 | 1547 | | |
1547 | 1548 | | |
1548 | 1549 | | |
1549 | 1550 | | |
1550 | 1551 | | |
| 1552 | + | |
1551 | 1553 | | |
1552 | 1554 | | |
1553 | 1555 | | |
| |||
1563 | 1565 | | |
1564 | 1566 | | |
1565 | 1567 | | |
| 1568 | + | |
| 1569 | + | |
1566 | 1570 | | |
1567 | 1571 | | |
1568 | 1572 | | |
| |||
0 commit comments