Skip to content

Commit 23f52e9

Browse files
committed
clean up
1 parent 82f215e commit 23f52e9

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

src/xdist/workermanage.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,39 +99,25 @@ def setup_nodes(
9999

100100
self.config.hook.pytest_xdist_setupnodes(config=self.config, specs=self.specs)
101101
self.trace("setting up nodes")
102-
import threading
103-
lock = threading.Lock()
104102
with ThreadPoolExecutor(max_workers=len(self.specs)) as executor:
105103
futs = [
106-
executor.submit(self.setup_node, spec, putevent, idx, lock)
104+
executor.submit(self.setup_node, spec, putevent, idx)
107105
for idx, spec in enumerate(self.specs)
108106
]
109107
results = [f.result() for f in futs]
110108
for r in results:
111109
self.config.hook.pytest_xdist_newgateway(gateway=r.gateway)
112110
return results
113-
# return [self.setup_node(spec, putevent) for spec in self.specs]
114111

115112
def setup_node(
116113
self,
117114
spec: execnet.XSpec,
118115
putevent: Callable[[tuple[str, dict[str, Any]]], None],
119116
idx: int | None = None,
120-
lock = None,
121117
) -> WorkerController:
122-
if lock is None:
123-
import threading
124-
lock = threading.Lock()
125118
if getattr(spec, "execmodel", None) != "main_thread_only":
126119
spec = execnet.XSpec(f"execmodel=main_thread_only//{spec}")
127-
# if idx is not None:
128-
# spec = execnet.XSpec(f"{spec}//id=gw{idx}")
129-
print('theoretical gateway id', idx, spec.id)
130120
gw = self.group.makegateway(spec)
131-
# with lock:
132-
# print('calling pytest_xdist_newgateway with gateway id', gw.id)
133-
# self.config.hook.pytest_xdist_newgateway(gateway=gw)
134-
print(f"setup_node: {gw} {spec}")
135121
self.rsync_roots(gw)
136122
node = WorkerController(self, gw, self.config, putevent)
137123
# Keep the node alive.

testing/test_workermanage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_popen_makegateway_events(
8383
assert len(call.specs) == 2
8484

8585
call = hookrecorder.popcall("pytest_xdist_newgateway")
86-
# assert call.gateway.spec == execnet.XSpec("execmodel=main_thread_only//popen")
86+
assert call.gateway.spec == execnet.XSpec("execmodel=main_thread_only//popen")
8787
assert call.gateway.id == "gw0"
8888
call = hookrecorder.popcall("pytest_xdist_newgateway")
8989
assert call.gateway.id == "gw1"

0 commit comments

Comments
 (0)