Finish deprecation of "slave"
This commit is contained in:
@@ -341,7 +341,7 @@ class LFPlugin:
|
||||
|
||||
def pytest_sessionfinish(self, session: Session) -> None:
|
||||
config = self.config
|
||||
if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
|
||||
if config.getoption("cacheshow") or hasattr(config, "workerinput"):
|
||||
return
|
||||
|
||||
assert config.cache is not None
|
||||
@@ -386,7 +386,7 @@ class NFPlugin:
|
||||
|
||||
def pytest_sessionfinish(self) -> None:
|
||||
config = self.config
|
||||
if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
|
||||
if config.getoption("cacheshow") or hasattr(config, "workerinput"):
|
||||
return
|
||||
|
||||
if config.getoption("collectonly"):
|
||||
|
||||
@@ -427,8 +427,8 @@ def pytest_addoption(parser: Parser) -> None:
|
||||
|
||||
def pytest_configure(config: Config) -> None:
|
||||
xmlpath = config.option.xmlpath
|
||||
# prevent opening xmllog on slave nodes (xdist)
|
||||
if xmlpath and not hasattr(config, "slaveinput"):
|
||||
# prevent opening xmllog on worker nodes (xdist)
|
||||
if xmlpath and not hasattr(config, "workerinput"):
|
||||
junit_family = config.getini("junit_family")
|
||||
if not junit_family:
|
||||
_issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)
|
||||
@@ -506,17 +506,17 @@ class LogXML:
|
||||
def finalize(self, report: TestReport) -> None:
|
||||
nodeid = getattr(report, "nodeid", report)
|
||||
# local hack to handle xdist report order
|
||||
slavenode = getattr(report, "node", None)
|
||||
reporter = self.node_reporters.pop((nodeid, slavenode))
|
||||
workernode = getattr(report, "node", None)
|
||||
reporter = self.node_reporters.pop((nodeid, workernode))
|
||||
if reporter is not None:
|
||||
reporter.finalize()
|
||||
|
||||
def node_reporter(self, report: Union[TestReport, str]) -> _NodeReporter:
|
||||
nodeid = getattr(report, "nodeid", report) # type: Union[str, TestReport]
|
||||
# local hack to handle xdist report order
|
||||
slavenode = getattr(report, "node", None)
|
||||
workernode = getattr(report, "node", None)
|
||||
|
||||
key = nodeid, slavenode
|
||||
key = nodeid, workernode
|
||||
|
||||
if key in self.node_reporters:
|
||||
# TODO: breaks for --dist=each
|
||||
|
||||
@@ -33,7 +33,7 @@ def pytest_configure(config: Config) -> None:
|
||||
if config.option.pastebin == "all":
|
||||
tr = config.pluginmanager.getplugin("terminalreporter")
|
||||
# if no terminal reporter plugin is present, nothing we can do here;
|
||||
# this can happen when this function executes in a slave node
|
||||
# this can happen when this function executes in a worker node
|
||||
# when using pytest-xdist, for example
|
||||
if tr is not None:
|
||||
# pastebin file will be utf-8 encoded binary file
|
||||
|
||||
@@ -38,13 +38,13 @@ if TYPE_CHECKING:
|
||||
from _pytest.runner import CallInfo
|
||||
|
||||
|
||||
def getslaveinfoline(node):
|
||||
def getworkerinfoline(node):
|
||||
try:
|
||||
return node._slaveinfocache
|
||||
return node._workerinfocache
|
||||
except AttributeError:
|
||||
d = node.slaveinfo
|
||||
d = node.workerinfo
|
||||
ver = "%s.%s.%s" % d["version_info"][:3]
|
||||
node._slaveinfocache = s = "[{}] {} -- Python {} {}".format(
|
||||
node._workerinfocache = s = "[{}] {} -- Python {} {}".format(
|
||||
d["id"], d["sysplatform"], ver, d["executable"]
|
||||
)
|
||||
return s
|
||||
@@ -71,7 +71,7 @@ class BaseReport:
|
||||
|
||||
def toterminal(self, out) -> None:
|
||||
if hasattr(self, "node"):
|
||||
out.line(getslaveinfoline(self.node))
|
||||
out.line(getworkerinfoline(self.node))
|
||||
|
||||
longrepr = self.longrepr
|
||||
if longrepr is None:
|
||||
|
||||
@@ -29,8 +29,8 @@ def pytest_addoption(parser: Parser) -> None:
|
||||
|
||||
def pytest_configure(config: Config) -> None:
|
||||
resultlog = config.option.resultlog
|
||||
# prevent opening resultlog on slave nodes (xdist)
|
||||
if resultlog and not hasattr(config, "slaveinput"):
|
||||
# prevent opening resultlog on worker nodes (xdist)
|
||||
if resultlog and not hasattr(config, "workerinput"):
|
||||
dirname = os.path.dirname(os.path.abspath(resultlog))
|
||||
if not os.path.isdir(dirname):
|
||||
os.makedirs(dirname)
|
||||
|
||||
Reference in New Issue
Block a user