Finish removal of "slave" terminology

See issue #234.  It's time.
This commit is contained in:
Zac-HD
2020-06-12 18:00:28 +10:00
parent f23c717a36
commit de3e54fd27
10 changed files with 8 additions and 47 deletions

View File

@@ -1,6 +1,5 @@
environment: environment:
matrix: matrix:
- TOXENV: "py27-pytestlatest"
- TOXENV: "py35-pytestlatest" - TOXENV: "py35-pytestlatest"
- TOXENV: "py36-pytestlatest" - TOXENV: "py36-pytestlatest"
- TOXENV: "py37-pytestlatest" - TOXENV: "py37-pytestlatest"

View File

@@ -32,8 +32,6 @@ jobs:
- $HOME/.cache/pre-commit - $HOME/.cache/pre-commit
- python: '3.8' - python: '3.8'
env: TOXENV=py38-pytestlatest env: TOXENV=py38-pytestlatest
- python: '2.7'
env: TOXENV=py27-pytestlatest
- stage: test - stage: test
python: "3.5" python: "3.5"

View File

@@ -0,0 +1 @@
drop backward-compatibility "slave" aliases related to worker nodes. We deliberately moved away from this terminology years ago, and it seems like the right time to finish the deprecation and removal process.

View File

@@ -1,12 +1,6 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
install_requires = [ install_requires = ["execnet>=1.1", "psutil>=3.0.0", "pytest>=6.0.0", "pytest-forked"]
"execnet>=1.1",
"psutil>=3.0.0",
"pytest>=4.4.0",
"pytest-forked",
"six",
]
with open("README.rst") as f: with open("README.rst") as f:
@@ -15,8 +9,7 @@ with open("README.rst") as f:
setup( setup(
name="pytest-xdist", name="pytest-xdist",
use_scm_version={"write_to": "src/xdist/_version.py"}, use_scm_version={"write_to": "src/xdist/_version.py"},
description="pytest xdist plugin for distributed testing" description="pytest xdist plugin for distributed testing and loop-on-failing modes",
" and loop-on-failing modes",
long_description=long_description, long_description=long_description,
license="MIT", license="MIT",
author="holger krekel and contributors", author="holger krekel and contributors",
@@ -30,7 +23,7 @@ setup(
"pytest11": ["xdist = xdist.plugin", "xdist.looponfail = xdist.looponfail"] "pytest11": ["xdist = xdist.plugin", "xdist.looponfail = xdist.looponfail"]
}, },
zip_safe=False, zip_safe=False,
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", python_requires=">=3.5",
install_requires=install_requires, install_requires=install_requires,
setup_requires=["setuptools_scm"], setup_requires=["setuptools_scm"],
classifiers=[ classifiers=[
@@ -45,9 +38,8 @@ setup(
"Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Quality Assurance",
"Topic :: Utilities", "Topic :: Utilities",
"Programming Language :: Python", "Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",

View File

@@ -150,9 +150,6 @@ class DSession(object):
node.workerinfo["id"] = node.gateway.id node.workerinfo["id"] = node.gateway.id
node.workerinfo["spec"] = node.gateway.spec node.workerinfo["spec"] = node.gateway.spec
# TODO: (#234 task) needs this for pytest. Remove when refactor in pytest repo
node.slaveinfo = node.workerinfo
self.config.hook.pytest_testnodeready(node=node) self.config.hook.pytest_testnodeready(node=node)
if self.shuttingdown: if self.shuttingdown:
node.shutdown() node.shutdown()

View File

@@ -43,14 +43,11 @@ def pytest_addoption(parser):
) )
group.addoption( group.addoption(
"--max-worker-restart", "--max-worker-restart",
"--max-slave-restart",
action="store", action="store",
default=None, default=None,
dest="maxworkerrestart", dest="maxworkerrestart",
help="maximum number of workers that can be restarted " help="maximum number of workers that can be restarted "
"when crashed (set to zero to disable this feature)\n" "when crashed (set to zero to disable this feature)",
"'--max-slave-restart' option is deprecated and will be removed in "
"a future release",
) )
group.addoption( group.addoption(
"--dist", "--dist",

View File

@@ -266,8 +266,5 @@ if __name__ == "__channelexec__":
config._parser.prog = os.path.basename(workerinput["mainargv"][0]) config._parser.prog = os.path.basename(workerinput["mainargv"][0])
config.workerinput = workerinput config.workerinput = workerinput
config.workeroutput = {} config.workeroutput = {}
# TODO: deprecated name, backward compatibility only. Remove it in future
config.slaveinput = config.workerinput
config.slaveoutput = config.workeroutput
interactor = WorkerInteractor(config, channel) interactor = WorkerInteractor(config, channel)
config.hook.pytest_cmdline_main(config=config) config.hook.pytest_cmdline_main(config=config)

View File

@@ -228,13 +228,9 @@ class WorkerController(object):
self.workerinput = { self.workerinput = {
"workerid": gateway.id, "workerid": gateway.id,
"workercount": len(nodemanager.specs), "workercount": len(nodemanager.specs),
"slaveid": gateway.id,
"slavecount": len(nodemanager.specs),
"testrunuid": nodemanager.testrunuid, "testrunuid": nodemanager.testrunuid,
"mainargv": sys.argv, "mainargv": sys.argv,
} }
# TODO: deprecated name, backward compatibility only. Remove it in future
self.slaveinput = self.workerinput
self._down = False self._down = False
self._shutdown_sent = False self._shutdown_sent = False
self.log = py.log.Producer("workerctl-%s" % gateway.id) self.log = py.log.Producer("workerctl-%s" % gateway.id)
@@ -333,7 +329,7 @@ class WorkerController(object):
self.notify_inproc(eventname, node=self, **kwargs) self.notify_inproc(eventname, node=self, **kwargs)
elif eventname == "workerfinished": elif eventname == "workerfinished":
self._down = True self._down = True
self.workeroutput = self.slaveoutput = kwargs["workeroutput"] self.workeroutput = kwargs["workeroutput"]
self.notify_inproc("workerfinished", node=self) self.notify_inproc("workerfinished", node=self)
elif eventname in ("logstart", "logfinish"): elif eventname in ("logstart", "logfinish"):
self.notify_inproc(eventname, node=self, **kwargs) self.notify_inproc(eventname, node=self, **kwargs)

View File

@@ -245,22 +245,6 @@ class TestDistribution:
result.stderr.fnmatch_lines(["--foobar=123 active! *"]) result.stderr.fnmatch_lines(["--foobar=123 active! *"])
assert dest.join(subdir.basename).check(dir=1) assert dest.join(subdir.basename).check(dir=1)
def test_backward_compatibility_worker_terminology(self, testdir):
"""Ensure that we still support "config.slaveinput" for backward compatibility (#234).
Keep in mind that removing this compatibility will break a ton of plugins and user code.
"""
testdir.makepyfile(
"""
def test(pytestconfig):
assert hasattr(pytestconfig, 'slaveinput')
assert hasattr(pytestconfig, 'workerinput')
"""
)
result = testdir.runpytest("-n1")
result.stdout.fnmatch_lines("*1 passed*")
assert result.ret == 0
def test_data_exchange(self, testdir): def test_data_exchange(self, testdir):
testdir.makeconftest( testdir.makeconftest(
""" """

View File

@@ -1,7 +1,7 @@
[tox] [tox]
envlist= envlist=
linting linting
py{27,35,36,37,38}-pytestlatest py{35,36,37,38}-pytestlatest
py38-pytestmaster py38-pytestmaster
[testenv] [testenv]