diff --git a/changelog/7356.trivial.rst b/changelog/7356.trivial.rst new file mode 100644 index 00000000000..d280e229125 --- /dev/null +++ b/changelog/7356.trivial.rst @@ -0,0 +1 @@ +Remove last internal uses of deprecated "slave" term from old pytest-xdist. diff --git a/doc/en/announce/release-2.3.5.rst b/doc/en/announce/release-2.3.5.rst index 465dd826ed4..d68780a2440 100644 --- a/doc/en/announce/release-2.3.5.rst +++ b/doc/en/announce/release-2.3.5.rst @@ -46,7 +46,7 @@ Changes between 2.3.4 and 2.3.5 - Issue 265 - integrate nose setup/teardown with setupstate 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 when doctest does not know the example location diff --git a/doc/en/announce/release-2.6.1.rst b/doc/en/announce/release-2.6.1.rst index fba6f2993a5..85d9861643a 100644 --- a/doc/en/announce/release-2.6.1.rst +++ b/doc/en/announce/release-2.6.1.rst @@ -32,7 +32,7 @@ Changes 2.6.1 purely the nodeid. The line number is still shown in failure reports. 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. - fix issue555: add "errors" attribute to capture-streams to satisfy diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 1a298072b0f..2806fb6a3e5 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -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. 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. - fix issue555: add "errors" attribute to capture-streams to satisfy @@ -6706,7 +6706,7 @@ Bug fixes: - Issue 265 - integrate nose setup/teardown with setupstate 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 when doctest does not know the example location @@ -7588,7 +7588,7 @@ Bug fixes: - fix assert reinterpreation that sees a call containing "keyword=..." - 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. - fix issue65: properly handle dist-testing if no diff --git a/doc/en/funcarg_compare.rst b/doc/en/funcarg_compare.rst index af70301654d..4350c98b670 100644 --- a/doc/en/funcarg_compare.rst +++ b/doc/en/funcarg_compare.rst @@ -170,7 +170,7 @@ several problems: 1. in distributed testing the master process would setup test resources 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") resource-setup will still be executed. diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index af7d57a2490..9baee1d4e33 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -341,7 +341,7 @@ def pytest_collection_modifyitems( 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 @@ def _get_increasing_order(self, items: Iterable[nodes.Item]) -> List[nodes.Item] 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"): diff --git a/src/_pytest/junitxml.py b/src/_pytest/junitxml.py index 47ba89d38cd..e62bc5235e6 100644 --- a/src/_pytest/junitxml.py +++ b/src/_pytest/junitxml.py @@ -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 @@ def __init__( 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 diff --git a/src/_pytest/pastebin.py b/src/_pytest/pastebin.py index 7e6bbf50cbe..a3432c7a10c 100644 --- a/src/_pytest/pastebin.py +++ b/src/_pytest/pastebin.py @@ -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 diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index 7462cea0b69..6a408354b03 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -38,13 +38,13 @@ 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 @@ def __getattr__(self, key: str) -> Any: 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: diff --git a/src/_pytest/resultlog.py b/src/_pytest/resultlog.py index c2b0cf5563a..c870ef08eae 100644 --- a/src/_pytest/resultlog.py +++ b/src/_pytest/resultlog.py @@ -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) diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index d7771cc9708..f8a6a295f6b 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -866,12 +866,12 @@ def test_mangle_test_address(): 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] class FakeConfig: if TYPE_CHECKING: - slaveinput = None + workerinput = None def __init__(self): self.pluginmanager = self @@ -891,7 +891,7 @@ def getini(self, name): junitxml.pytest_configure(fake_config) assert len(gotten) == 1 - FakeConfig.slaveinput = None + FakeConfig.workerinput = None junitxml.pytest_configure(fake_config) assert len(gotten) == 1 @@ -1250,7 +1250,7 @@ def test_record({fixture_name}, other): 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 to produce correct reports. #1064 """ diff --git a/testing/test_resultlog.py b/testing/test_resultlog.py index bad575e3d13..8fc93d25c7d 100644 --- a/testing/test_resultlog.py +++ b/testing/test_resultlog.py @@ -177,7 +177,7 @@ def 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") assert resultlog_key not in config._store @@ -186,7 +186,7 @@ def test_no_resultlog_on_slaves(testdir): pytest_unconfigure(config) assert resultlog_key not in config._store - config.slaveinput = {} + config.workerinput = {} pytest_configure(config) assert resultlog_key not in config._store pytest_unconfigure(config)