Skip to content

Commit ede0c54

Browse files
amezinnicoddemus
andauthored
Apply suggestions from code review
Co-authored-by: Bruno Oliveira <[email protected]>
1 parent eb4388c commit ede0c54

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

changelog/1144.feature

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
Make "steal" command atomic - make it unschedule either all requested tests or none.
1+
The internal `steal` command is now atomic - make it unschedule either all requested tests or none.
2+
3+
This is a prerequisite for group/scope support in the `worksteal` scheduler, so tests won't be broken up incorrectly.

src/xdist/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Marker(enum.Enum):
7272

7373

7474
class TestQueue:
75-
"""A simple queue that can be inspected and modified while the lock is held."""
75+
"""A simple queue that can be inspected and modified while the lock is held via the ``lock()`` method."""
7676

7777
Item = Union[int, Literal[Marker.SHUTDOWN]]
7878

testing/test_remote.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ def test_func4(): pass
267267

268268
worker.sendcommand("steal", indices=[1, 2])
269269
ev = worker.popevent("unscheduled")
270+
# Cannot steal index 1 because it is completed already, so do not steal any.
270271
assert ev.kwargs["indices"] == []
271272

273+
# Index 2 can be stolen, as it is still pending.
272274
worker.sendcommand("steal", indices=[2])
273275
ev = worker.popevent("unscheduled")
274276
assert ev.kwargs["indices"] == [2]

0 commit comments

Comments
 (0)