Skip to content

Commit 88f431a

Browse files
committed
refactor: rename dest param name
1 parent bea28fb commit 88f431a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/xdist/plugin.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,16 @@ def pytest_addoption(parser: pytest.Parser) -> None:
129129
)
130130
group.addoption(
131131
"--no-loadscope-reorder",
132-
action="store_true",
133-
dest="noloadscopenoreorder",
134-
default=False,
132+
dest="loadscopereorder",
133+
action="store_false",
134+
default=True,
135135
help=(
136-
"Reorders tests when used in conjunction with loadscope.\n"
137-
"Will order tests by number of tests per scope as a best-effort"
138-
" attempt to evenly distribute scopes across all workers."
136+
"Pytest-xdist will default reorder tests by number of tests per scope "
137+
"when used in conjunction with loadscope.\n"
138+
"This option will disable loadscope reorder, "
139+
"and the partial order of tests can be retained.\n"
140+
"This is useful when pytest-xdist is used together with "
141+
"other plugins that specify tests in a specific order."
139142
),
140143
)
141144
group.addoption(

src/xdist/scheduler/loadscope.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,15 @@ def schedule(self) -> None:
371371
work_unit = unsorted_workqueue.setdefault(scope, {})
372372
work_unit[nodeid] = False
373373

374-
if self.config.option.noloadscopenoreorder:
375-
for scope, nodeids in unsorted_workqueue.items():
376-
self.workqueue[scope] = nodeids
377-
else:
374+
if self.config.option.loadscopereorder:
378375
# Insert tests scopes into work queue ordered by number of tests.
379376
for scope, nodeids in sorted(
380377
unsorted_workqueue.items(), key=lambda item: -len(item[1])
381378
):
382379
self.workqueue[scope] = nodeids
380+
else:
381+
for scope, nodeids in unsorted_workqueue.items():
382+
self.workqueue[scope] = nodeids
383383

384384
# Avoid having more workers than work
385385
extra_nodes = len(self.nodes) - len(self.workqueue)

0 commit comments

Comments
 (0)