Skip to content

Commit ab5f12f

Browse files
author
bwilson
committed
Revert "Adding RemoteTarget class to wrap module/function"
This reverts commit 3115543.
1 parent b28c3d9 commit ab5f12f

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

xdist/newhooks.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ def pytest_xdist_rsyncfinish(source, gateways):
3131

3232

3333
@pytest.mark.firstresult
34-
def pytest_xdist_getremotetarget():
35-
"""
36-
called to get the remote target.
37-
:return: a workermanager.RemoteTarget
38-
"""
34+
def pytest_xdist_getremotemodule():
35+
""" called when creating remote node"""
3936

4037

4138
def pytest_configure_node(node):

xdist/workermanage.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
import re
55
import threading
6-
import types
76

87
import py
98
import pytest
@@ -206,8 +205,8 @@ class WorkerController(object):
206205

207206
class RemoteHook:
208207
@pytest.mark.trylast
209-
def pytest_xdist_getremotetarget(self):
210-
return RemoteTarget(xdist.remote)
208+
def pytest_xdist_getremotemodule(self):
209+
return xdist.remote
211210

212211
def __init__(self, nodemanager, gateway, config, putevent):
213212
config.pluginmanager.register(self.RemoteHook())
@@ -249,8 +248,8 @@ def setup(self):
249248
basetemp = self.config._tmpdirhandler.getbasetemp()
250249
option_dict["basetemp"] = str(basetemp.join(name))
251250
self.config.hook.pytest_configure_node(node=self)
252-
target, _, target_kwargs = self.config.hook.pytest_xdist_getremotetarget().pack()
253-
self.channel = self.gateway.remote_exec(target, **target_kwargs)
251+
remote_module = self.config.hook.pytest_xdist_getremotemodule()
252+
self.channel = self.gateway.remote_exec(remote_module)
254253
self.channel.send((self.workerinput, args, option_dict))
255254
if self.putevent:
256255
self.channel.setcallback(self.process_from_remote, endmarker=self.ENDMARK)
@@ -360,23 +359,6 @@ def process_from_remote(self, eventcall): # noqa too complex
360359
self.notify_inproc("errordown", node=self, error=excinfo)
361360

362361

363-
class RemoteTarget:
364-
def __init__(self, target, *args, **kwargs):
365-
self._target = target
366-
self._args = args
367-
self._kwargs = kwargs
368-
self.validate()
369-
370-
def validate(self):
371-
# this is based on execnet criteria
372-
assert not self._args, "Positional arguments are not yet supported"
373-
if isinstance(self._target, types.ModuleType):
374-
assert not (self._args or self._kwargs), "Arguments are not used with module targets"
375-
376-
def pack(self):
377-
return self._target, self._args, self._kwargs
378-
379-
380362
def unserialize_report(name, reportdict):
381363
def assembled_report(reportdict):
382364
from _pytest._code.code import (

0 commit comments

Comments
 (0)