Join multiple xdist_group markers (#1201)

Fixes #1200

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
This commit is contained in:
Ygor Pontelo
2025-05-14 21:51:59 -03:00
committed by GitHub
parent 199f949716
commit 65de0ab30e
4 changed files with 87 additions and 9 deletions

View File

@@ -241,15 +241,17 @@ class WorkerInteractor:
# add the group name to nodeid as suffix if --dist=loadgroup
if config.getvalue("loadgroup"):
for item in items:
mark = item.get_closest_marker("xdist_group")
if not mark:
gnames: set[str] = set()
for mark in item.iter_markers("xdist_group"):
name = (
mark.args[0]
if len(mark.args) > 0
else mark.kwargs.get("name", "default")
)
gnames.add(name)
if not gnames:
continue
gname = (
mark.args[0]
if len(mark.args) > 0
else mark.kwargs.get("name", "default")
)
item._nodeid = f"{item.nodeid}@{gname}"
item._nodeid = f"{item.nodeid}@{'_'.join(sorted(gnames))}"
@pytest.hookimpl
def pytest_collection_finish(self, session: pytest.Session) -> None: