#234 Fix flake 8 and fix comments

This commit is contained in:
feuillemorte
2018-01-17 23:34:39 +03:00
parent 9a5a81962c
commit b04703b6ba
7 changed files with 23 additions and 17 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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'],

View File

@@ -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)

View File

@@ -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)