Merge pull request #7356 from Zac-HD/emancipate
Finish deprecation of "slave"
This commit is contained in:
commit
0f30103d9c
|
@ -0,0 +1 @@
|
||||||
|
Remove last internal uses of deprecated "slave" term from old pytest-xdist.
|
|
@ -46,7 +46,7 @@ Changes between 2.3.4 and 2.3.5
|
||||||
- Issue 265 - integrate nose setup/teardown with setupstate
|
- Issue 265 - integrate nose setup/teardown with setupstate
|
||||||
so it doesn't try to teardown if it did not setup
|
so it doesn't try to teardown if it did not setup
|
||||||
|
|
||||||
- issue 271 - don't write junitxml on slave nodes
|
- issue 271 - don't write junitxml on worker nodes
|
||||||
|
|
||||||
- Issue 274 - don't try to show full doctest example
|
- Issue 274 - don't try to show full doctest example
|
||||||
when doctest does not know the example location
|
when doctest does not know the example location
|
||||||
|
|
|
@ -32,7 +32,7 @@ Changes 2.6.1
|
||||||
purely the nodeid. The line number is still shown in failure reports.
|
purely the nodeid. The line number is still shown in failure reports.
|
||||||
Thanks Floris Bruynooghe.
|
Thanks Floris Bruynooghe.
|
||||||
|
|
||||||
- fix issue437 where assertion rewriting could cause pytest-xdist slaves
|
- fix issue437 where assertion rewriting could cause pytest-xdist worker nodes
|
||||||
to collect different tests. Thanks Bruno Oliveira.
|
to collect different tests. Thanks Bruno Oliveira.
|
||||||
|
|
||||||
- fix issue555: add "errors" attribute to capture-streams to satisfy
|
- fix issue555: add "errors" attribute to capture-streams to satisfy
|
||||||
|
|
|
@ -6159,7 +6159,7 @@ time or change existing behaviors in order to make them less surprising/more use
|
||||||
purely the nodeid. The line number is still shown in failure reports.
|
purely the nodeid. The line number is still shown in failure reports.
|
||||||
Thanks Floris Bruynooghe.
|
Thanks Floris Bruynooghe.
|
||||||
|
|
||||||
- fix issue437 where assertion rewriting could cause pytest-xdist slaves
|
- fix issue437 where assertion rewriting could cause pytest-xdist worker nodes
|
||||||
to collect different tests. Thanks Bruno Oliveira.
|
to collect different tests. Thanks Bruno Oliveira.
|
||||||
|
|
||||||
- fix issue555: add "errors" attribute to capture-streams to satisfy
|
- fix issue555: add "errors" attribute to capture-streams to satisfy
|
||||||
|
@ -6706,7 +6706,7 @@ Bug fixes:
|
||||||
- Issue 265 - integrate nose setup/teardown with setupstate
|
- Issue 265 - integrate nose setup/teardown with setupstate
|
||||||
so it doesn't try to teardown if it did not setup
|
so it doesn't try to teardown if it did not setup
|
||||||
|
|
||||||
- issue 271 - don't write junitxml on slave nodes
|
- issue 271 - don't write junitxml on worker nodes
|
||||||
|
|
||||||
- Issue 274 - don't try to show full doctest example
|
- Issue 274 - don't try to show full doctest example
|
||||||
when doctest does not know the example location
|
when doctest does not know the example location
|
||||||
|
@ -7588,7 +7588,7 @@ Bug fixes:
|
||||||
- fix assert reinterpreation that sees a call containing "keyword=..."
|
- fix assert reinterpreation that sees a call containing "keyword=..."
|
||||||
|
|
||||||
- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish
|
- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish
|
||||||
hooks on slaves during dist-testing, report module/session teardown
|
hooks on worker nodes during dist-testing, report module/session teardown
|
||||||
hooks correctly.
|
hooks correctly.
|
||||||
|
|
||||||
- fix issue65: properly handle dist-testing if no
|
- fix issue65: properly handle dist-testing if no
|
||||||
|
|
|
@ -170,7 +170,7 @@ several problems:
|
||||||
|
|
||||||
1. in distributed testing the master process would setup test resources
|
1. in distributed testing the master process would setup test resources
|
||||||
that are never needed because it only co-ordinates the test run
|
that are never needed because it only co-ordinates the test run
|
||||||
activities of the slave processes.
|
activities of the worker processes.
|
||||||
|
|
||||||
2. if you only perform a collection (with "--collect-only")
|
2. if you only perform a collection (with "--collect-only")
|
||||||
resource-setup will still be executed.
|
resource-setup will still be executed.
|
||||||
|
|
|
@ -341,7 +341,7 @@ class LFPlugin:
|
||||||
|
|
||||||
def pytest_sessionfinish(self, session: Session) -> None:
|
def pytest_sessionfinish(self, session: Session) -> None:
|
||||||
config = self.config
|
config = self.config
|
||||||
if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
|
if config.getoption("cacheshow") or hasattr(config, "workerinput"):
|
||||||
return
|
return
|
||||||
|
|
||||||
assert config.cache is not None
|
assert config.cache is not None
|
||||||
|
@ -386,7 +386,7 @@ class NFPlugin:
|
||||||
|
|
||||||
def pytest_sessionfinish(self) -> None:
|
def pytest_sessionfinish(self) -> None:
|
||||||
config = self.config
|
config = self.config
|
||||||
if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
|
if config.getoption("cacheshow") or hasattr(config, "workerinput"):
|
||||||
return
|
return
|
||||||
|
|
||||||
if config.getoption("collectonly"):
|
if config.getoption("collectonly"):
|
||||||
|
|
|
@ -427,8 +427,8 @@ def pytest_addoption(parser: Parser) -> None:
|
||||||
|
|
||||||
def pytest_configure(config: Config) -> None:
|
def pytest_configure(config: Config) -> None:
|
||||||
xmlpath = config.option.xmlpath
|
xmlpath = config.option.xmlpath
|
||||||
# prevent opening xmllog on slave nodes (xdist)
|
# prevent opening xmllog on worker nodes (xdist)
|
||||||
if xmlpath and not hasattr(config, "slaveinput"):
|
if xmlpath and not hasattr(config, "workerinput"):
|
||||||
junit_family = config.getini("junit_family")
|
junit_family = config.getini("junit_family")
|
||||||
if not junit_family:
|
if not junit_family:
|
||||||
_issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)
|
_issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)
|
||||||
|
@ -506,17 +506,17 @@ class LogXML:
|
||||||
def finalize(self, report: TestReport) -> None:
|
def finalize(self, report: TestReport) -> None:
|
||||||
nodeid = getattr(report, "nodeid", report)
|
nodeid = getattr(report, "nodeid", report)
|
||||||
# local hack to handle xdist report order
|
# local hack to handle xdist report order
|
||||||
slavenode = getattr(report, "node", None)
|
workernode = getattr(report, "node", None)
|
||||||
reporter = self.node_reporters.pop((nodeid, slavenode))
|
reporter = self.node_reporters.pop((nodeid, workernode))
|
||||||
if reporter is not None:
|
if reporter is not None:
|
||||||
reporter.finalize()
|
reporter.finalize()
|
||||||
|
|
||||||
def node_reporter(self, report: Union[TestReport, str]) -> _NodeReporter:
|
def node_reporter(self, report: Union[TestReport, str]) -> _NodeReporter:
|
||||||
nodeid = getattr(report, "nodeid", report) # type: Union[str, TestReport]
|
nodeid = getattr(report, "nodeid", report) # type: Union[str, TestReport]
|
||||||
# local hack to handle xdist report order
|
# 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:
|
if key in self.node_reporters:
|
||||||
# TODO: breaks for --dist=each
|
# TODO: breaks for --dist=each
|
||||||
|
|
|
@ -33,7 +33,7 @@ def pytest_configure(config: Config) -> None:
|
||||||
if config.option.pastebin == "all":
|
if config.option.pastebin == "all":
|
||||||
tr = config.pluginmanager.getplugin("terminalreporter")
|
tr = config.pluginmanager.getplugin("terminalreporter")
|
||||||
# if no terminal reporter plugin is present, nothing we can do here;
|
# 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
|
# when using pytest-xdist, for example
|
||||||
if tr is not None:
|
if tr is not None:
|
||||||
# pastebin file will be utf-8 encoded binary file
|
# pastebin file will be utf-8 encoded binary file
|
||||||
|
|
|
@ -38,13 +38,13 @@ if TYPE_CHECKING:
|
||||||
from _pytest.runner import CallInfo
|
from _pytest.runner import CallInfo
|
||||||
|
|
||||||
|
|
||||||
def getslaveinfoline(node):
|
def getworkerinfoline(node):
|
||||||
try:
|
try:
|
||||||
return node._slaveinfocache
|
return node._workerinfocache
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
d = node.slaveinfo
|
d = node.workerinfo
|
||||||
ver = "%s.%s.%s" % d["version_info"][:3]
|
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"]
|
d["id"], d["sysplatform"], ver, d["executable"]
|
||||||
)
|
)
|
||||||
return s
|
return s
|
||||||
|
@ -71,7 +71,7 @@ class BaseReport:
|
||||||
|
|
||||||
def toterminal(self, out) -> None:
|
def toterminal(self, out) -> None:
|
||||||
if hasattr(self, "node"):
|
if hasattr(self, "node"):
|
||||||
out.line(getslaveinfoline(self.node))
|
out.line(getworkerinfoline(self.node))
|
||||||
|
|
||||||
longrepr = self.longrepr
|
longrepr = self.longrepr
|
||||||
if longrepr is None:
|
if longrepr is None:
|
||||||
|
|
|
@ -29,8 +29,8 @@ def pytest_addoption(parser: Parser) -> None:
|
||||||
|
|
||||||
def pytest_configure(config: Config) -> None:
|
def pytest_configure(config: Config) -> None:
|
||||||
resultlog = config.option.resultlog
|
resultlog = config.option.resultlog
|
||||||
# prevent opening resultlog on slave nodes (xdist)
|
# prevent opening resultlog on worker nodes (xdist)
|
||||||
if resultlog and not hasattr(config, "slaveinput"):
|
if resultlog and not hasattr(config, "workerinput"):
|
||||||
dirname = os.path.dirname(os.path.abspath(resultlog))
|
dirname = os.path.dirname(os.path.abspath(resultlog))
|
||||||
if not os.path.isdir(dirname):
|
if not os.path.isdir(dirname):
|
||||||
os.makedirs(dirname)
|
os.makedirs(dirname)
|
||||||
|
|
|
@ -866,12 +866,12 @@ def test_mangle_test_address():
|
||||||
assert newnames == ["a.my.py.thing", "Class", "method", "[a-1-::]"]
|
assert newnames == ["a.my.py.thing", "Class", "method", "[a-1-::]"]
|
||||||
|
|
||||||
|
|
||||||
def test_dont_configure_on_slaves(tmpdir) -> None:
|
def test_dont_configure_on_workers(tmpdir) -> None:
|
||||||
gotten = [] # type: List[object]
|
gotten = [] # type: List[object]
|
||||||
|
|
||||||
class FakeConfig:
|
class FakeConfig:
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
slaveinput = None
|
workerinput = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.pluginmanager = self
|
self.pluginmanager = self
|
||||||
|
@ -891,7 +891,7 @@ def test_dont_configure_on_slaves(tmpdir) -> None:
|
||||||
|
|
||||||
junitxml.pytest_configure(fake_config)
|
junitxml.pytest_configure(fake_config)
|
||||||
assert len(gotten) == 1
|
assert len(gotten) == 1
|
||||||
FakeConfig.slaveinput = None
|
FakeConfig.workerinput = None
|
||||||
junitxml.pytest_configure(fake_config)
|
junitxml.pytest_configure(fake_config)
|
||||||
assert len(gotten) == 1
|
assert len(gotten) == 1
|
||||||
|
|
||||||
|
@ -1250,7 +1250,7 @@ def test_record_fixtures_xunit2(testdir, fixture_name, run_and_parse):
|
||||||
|
|
||||||
|
|
||||||
def test_random_report_log_xdist(testdir, monkeypatch, run_and_parse):
|
def test_random_report_log_xdist(testdir, monkeypatch, run_and_parse):
|
||||||
"""xdist calls pytest_runtest_logreport as they are executed by the slaves,
|
"""xdist calls pytest_runtest_logreport as they are executed by the workers,
|
||||||
with nodes from several nodes overlapping, so junitxml must cope with that
|
with nodes from several nodes overlapping, so junitxml must cope with that
|
||||||
to produce correct reports. #1064
|
to produce correct reports. #1064
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -177,7 +177,7 @@ def test_makedir_for_resultlog(testdir, LineMatcher):
|
||||||
LineMatcher(lines).fnmatch_lines([". *:test_pass"])
|
LineMatcher(lines).fnmatch_lines([". *:test_pass"])
|
||||||
|
|
||||||
|
|
||||||
def test_no_resultlog_on_slaves(testdir):
|
def test_no_resultlog_on_workers(testdir):
|
||||||
config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")
|
config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")
|
||||||
|
|
||||||
assert resultlog_key not in config._store
|
assert resultlog_key not in config._store
|
||||||
|
@ -186,7 +186,7 @@ def test_no_resultlog_on_slaves(testdir):
|
||||||
pytest_unconfigure(config)
|
pytest_unconfigure(config)
|
||||||
assert resultlog_key not in config._store
|
assert resultlog_key not in config._store
|
||||||
|
|
||||||
config.slaveinput = {}
|
config.workerinput = {}
|
||||||
pytest_configure(config)
|
pytest_configure(config)
|
||||||
assert resultlog_key not in config._store
|
assert resultlog_key not in config._store
|
||||||
pytest_unconfigure(config)
|
pytest_unconfigure(config)
|
||||||
|
|
Loading…
Reference in New Issue