Commit 86ee308
committed
gh-157157: Make test_taskgroup_cancel_keeps_outer_cancellation deterministic
The test cancelled the parent task from outside after a 10 ms sleep,
expecting the group to still be waiting for its child. If the event loop
stalled for longer than that before the body task first ran, the outer
cancel() landed while the parent's awaited future was already cancelled
by the group, and its message was dropped, failing the test on slow
builds such as the TSan CI job.
Synchronize on events instead: the child signals from its finally block
that the group is cancelling and waits to be released, and only then is
the parent task cancelled from outside.1 parent 0b4c7da commit 86ee308
2 files changed
Lines changed: 11 additions & 2 deletions
File tree
- Lib/test/test_asyncio
- Misc/NEWS.d/next/Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1200 | 1200 | | |
1201 | 1201 | | |
1202 | 1202 | | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
1203 | 1206 | | |
1204 | 1207 | | |
1205 | 1208 | | |
1206 | 1209 | | |
1207 | | - | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1208 | 1214 | | |
1209 | 1215 | | |
1210 | 1216 | | |
| |||
1213 | 1219 | | |
1214 | 1220 | | |
1215 | 1221 | | |
1216 | | - | |
| 1222 | + | |
1217 | 1223 | | |
| 1224 | + | |
1218 | 1225 | | |
1219 | 1226 | | |
1220 | 1227 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments