Revert "Adding RemoteTarget class to wrap module/function"
This reverts commit 311554324a.
This commit is contained in:
@@ -31,11 +31,8 @@ def pytest_xdist_rsyncfinish(source, gateways):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.firstresult
|
@pytest.mark.firstresult
|
||||||
def pytest_xdist_getremotetarget():
|
def pytest_xdist_getremotemodule():
|
||||||
"""
|
""" called when creating remote node"""
|
||||||
called to get the remote target.
|
|
||||||
:return: a workermanager.RemoteTarget
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure_node(node):
|
def pytest_configure_node(node):
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import fnmatch
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import threading
|
import threading
|
||||||
import types
|
|
||||||
|
|
||||||
import py
|
import py
|
||||||
import pytest
|
import pytest
|
||||||
@@ -206,8 +205,8 @@ class WorkerController(object):
|
|||||||
|
|
||||||
class RemoteHook:
|
class RemoteHook:
|
||||||
@pytest.mark.trylast
|
@pytest.mark.trylast
|
||||||
def pytest_xdist_getremotetarget(self):
|
def pytest_xdist_getremotemodule(self):
|
||||||
return RemoteTarget(xdist.remote)
|
return xdist.remote
|
||||||
|
|
||||||
def __init__(self, nodemanager, gateway, config, putevent):
|
def __init__(self, nodemanager, gateway, config, putevent):
|
||||||
config.pluginmanager.register(self.RemoteHook())
|
config.pluginmanager.register(self.RemoteHook())
|
||||||
@@ -249,8 +248,8 @@ class WorkerController(object):
|
|||||||
basetemp = self.config._tmpdirhandler.getbasetemp()
|
basetemp = self.config._tmpdirhandler.getbasetemp()
|
||||||
option_dict["basetemp"] = str(basetemp.join(name))
|
option_dict["basetemp"] = str(basetemp.join(name))
|
||||||
self.config.hook.pytest_configure_node(node=self)
|
self.config.hook.pytest_configure_node(node=self)
|
||||||
target, _, target_kwargs = self.config.hook.pytest_xdist_getremotetarget().pack()
|
remote_module = self.config.hook.pytest_xdist_getremotemodule()
|
||||||
self.channel = self.gateway.remote_exec(target, **target_kwargs)
|
self.channel = self.gateway.remote_exec(remote_module)
|
||||||
self.channel.send((self.workerinput, args, option_dict))
|
self.channel.send((self.workerinput, args, option_dict))
|
||||||
if self.putevent:
|
if self.putevent:
|
||||||
self.channel.setcallback(self.process_from_remote, endmarker=self.ENDMARK)
|
self.channel.setcallback(self.process_from_remote, endmarker=self.ENDMARK)
|
||||||
@@ -360,23 +359,6 @@ class WorkerController(object):
|
|||||||
self.notify_inproc("errordown", node=self, error=excinfo)
|
self.notify_inproc("errordown", node=self, error=excinfo)
|
||||||
|
|
||||||
|
|
||||||
class RemoteTarget:
|
|
||||||
def __init__(self, target, *args, **kwargs):
|
|
||||||
self._target = target
|
|
||||||
self._args = args
|
|
||||||
self._kwargs = kwargs
|
|
||||||
self.validate()
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
# this is based on execnet criteria
|
|
||||||
assert not self._args, "Positional arguments are not yet supported"
|
|
||||||
if isinstance(self._target, types.ModuleType):
|
|
||||||
assert not (self._args or self._kwargs), "Arguments are not used with module targets"
|
|
||||||
|
|
||||||
def pack(self):
|
|
||||||
return self._target, self._args, self._kwargs
|
|
||||||
|
|
||||||
|
|
||||||
def unserialize_report(name, reportdict):
|
def unserialize_report(name, reportdict):
|
||||||
def assembled_report(reportdict):
|
def assembled_report(reportdict):
|
||||||
from _pytest._code.code import (
|
from _pytest._code.code import (
|
||||||
|
|||||||
Reference in New Issue
Block a user