fix again

This commit is contained in:
Shane Smiskol
2025-07-25 19:36:55 -07:00
parent 68bf76dce4
commit f8ea4a23b7

View File

@@ -97,20 +97,21 @@ class NodeManager:
self.trace("setting up nodes") self.trace("setting up nodes")
with ThreadPoolExecutor(max_workers=len(self.specs)) as executor: with ThreadPoolExecutor(max_workers=len(self.specs)) as executor:
futs = [ futs = [
executor.submit(self.setup_node, idx, spec, putevent) executor.submit(self.setup_node, spec, putevent, idx)
for idx, spec in enumerate(self.specs) for idx, spec in enumerate(self.specs)
] ]
return [f.result() for f in futs] return [f.result() for f in futs]
def setup_node( def setup_node(
self, self,
idx: int,
spec: execnet.XSpec, spec: execnet.XSpec,
putevent: Callable[[tuple[str, dict[str, Any]]], None], putevent: Callable[[tuple[str, dict[str, Any]]], None],
idx: int = None,
) -> WorkerController: ) -> WorkerController:
if getattr(spec, "execmodel", None) != "main_thread_only": if getattr(spec, "execmodel", None) != "main_thread_only":
spec = execnet.XSpec(f"execmodel=main_thread_only//{spec}") spec = execnet.XSpec(f"execmodel=main_thread_only//{spec}")
spec = execnet.XSpec(f"{spec}//id=gw{idx}") if idx is not None:
spec = execnet.XSpec(f"{spec}//id=gw{idx}")
gw = self.group.makegateway(spec) gw = self.group.makegateway(spec)
self.config.hook.pytest_xdist_newgateway(gateway=gw) self.config.hook.pytest_xdist_newgateway(gateway=gw)
self.rsync_roots(gw) self.rsync_roots(gw)