diff --git a/testing/test_remote.py b/testing/test_remote.py index 6488f4a..cc21835 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -1,6 +1,6 @@ import py import pytest -from xdist.workermanage import workerController, unserialize_report +from xdist.workermanage import WorkerController, unserialize_report from xdist.remote import serialize_report import execnet import marshal @@ -26,7 +26,7 @@ class EventCall: return "" % (self.name, self.kwargs) -class workerSetup: +class WorkerSetup: use_callback = False def __init__(self, request, testdir): @@ -44,8 +44,8 @@ class workerSetup: class DummyMananger: specs = [0, 1] - self.slp = workerController(DummyMananger, self.gateway, config, - putevent) + self.slp = WorkerController(DummyMananger, self.gateway, config, + putevent) self.request.addfinalizer(self.slp.ensure_teardown) self.slp.setup() @@ -66,7 +66,7 @@ class workerSetup: @pytest.fixture def worker(request, testdir): - return workerSetup(request, testdir) + return WorkerSetup(request, testdir) @pytest.mark.xfail(reason='#59') @@ -243,7 +243,7 @@ class TestReportSerialization: assert newrep.longrepr == str(rep.longrepr) -class TestworkerInteractor: +class TestWorkerInteractor: def test_basic_collect_and_runtests(self, worker): worker.testdir.makepyfile(""" def test_func(): diff --git a/testing/test_slavemanage.py b/testing/test_slavemanage.py index fbce716..af3201c 100644 --- a/testing/test_slavemanage.py +++ b/testing/test_slavemanage.py @@ -40,7 +40,7 @@ def workercontroller(monkeypatch): def setup(self): pass - monkeypatch.setattr(workermanage, 'workerController', MockController) + monkeypatch.setattr(workermanage, 'WorkerController', MockController) return MockController diff --git a/xdist/dsession.py b/xdist/dsession.py index e6497e1..40ed0af 100644 --- a/xdist/dsession.py +++ b/xdist/dsession.py @@ -182,7 +182,7 @@ class DSession: self._active_nodes.remove(node) def worker_errordown(self, node, error): - """Emitted by the workerController when a node dies.""" + """Emitted by the WorkerController when a node dies.""" self.config.hook.pytest_testnodedown(node=node, error=error) try: crashitem = self.sched.remove_node(node) diff --git a/xdist/looponfail.py b/xdist/looponfail.py index 3dcf71e..8253f9a 100644 --- a/xdist/looponfail.py +++ b/xdist/looponfail.py @@ -153,11 +153,11 @@ def init_worker_session(channel, args, option_dict): from _pytest.config import Config config = Config.fromdictargs(option_dict, list(args)) config.args = args - from xdist.looponfail import workerFailSession - workerFailSession(config, channel).main() + from xdist.looponfail import WorkerFailSession + WorkerFailSession(config, channel).main() -class workerFailSession: +class WorkerFailSession: def __init__(self, config, channel): self.config = config self.channel = channel diff --git a/xdist/plugin.py b/xdist/plugin.py index d60f8f4..8009baa 100644 --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -30,7 +30,8 @@ def pytest_addoption(parser): dest="maxworkerrestart", help="maximum number of workers that can be restarted " "when crashed (set to zero to disable this feature)\n" - "'--max-slave-restart' option is deprecated and will be removed in a future release") + "'--max-slave-restart' option is deprecated and will be removed in " + "a future release") group.addoption( '--dist', metavar="distmode", action="store", choices=['each', 'load', 'loadscope', 'loadfile', 'no'], diff --git a/xdist/remote.py b/xdist/remote.py index 3cca9b2..346d6e5 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -14,7 +14,7 @@ import _pytest.hookspec import pytest -class workerInteractor: +class WorkerInteractor: def __init__(self, config, channel): self.config = config self.workerid = config.workerinput.get('workerid', "?") @@ -198,5 +198,8 @@ if __name__ == '__channelexec__': config = remote_initconfig(option_dict, args) config.workerinput = workerinput config.workeroutput = {} - interactor = workerInteractor(config, channel) + # TODO: deprecated name, backward compatibility only. Remove it in future + config.slaveinput = config.workerinput + config.slaveoutput = config.workeroutput + interactor = WorkerInteractor(config, channel) config.hook.pytest_cmdline_main(config=config) diff --git a/xdist/workermanage.py b/xdist/workermanage.py index 727dcb0..70e2be6 100644 --- a/xdist/workermanage.py +++ b/xdist/workermanage.py @@ -68,7 +68,7 @@ class NodeManager(object): gw = self.group.makegateway(spec) self.config.hook.pytest_xdist_newgateway(gateway=gw) self.rsync_roots(gw) - node = workerController(self, gw, self.config, putevent) + node = WorkerController(self, gw, self.config, putevent) gw.node = node # keep the node alive node.setup() self.trace("started node %r" % node) @@ -201,7 +201,7 @@ def make_reltoroot(roots, args): return result -class workerController(object): +class WorkerController(object): ENDMARK = -1 def __init__(self, nodemanager, gateway, config, putevent): @@ -210,7 +210,9 @@ class workerController(object): self.gateway = gateway self.config = config self.workerinput = {'workerid': gateway.id, - 'workercount': len(nodemanager.specs)} + 'workercount': len(nodemanager.specs)} + # TODO: deprecated name, backward compatibility only. Remove it in future + self.slaveinput = self.workerinput self._down = False self._shutdown_sent = False self.log = py.log.Producer("workerctl-%s" % gateway.id)