Skip to content

Commit

Permalink
Finish removal of "slave" terminology
Browse files Browse the repository at this point in the history
See issue #234.  It's time.
  • Loading branch information
Zac-HD committed Aug 3, 2020
1 parent f23c717 commit de3e54f
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 47 deletions.
1 change: 0 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
environment:
matrix:
- TOXENV: "py27-pytestlatest"
- TOXENV: "py35-pytestlatest"
- TOXENV: "py36-pytestlatest"
- TOXENV: "py37-pytestlatest"
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:
- $HOME/.cache/pre-commit
- python: '3.8'
env: TOXENV=py38-pytestlatest
- python: '2.7'
env: TOXENV=py27-pytestlatest

- stage: test
python: "3.5"
Expand Down
1 change: 1 addition & 0 deletions changelog/541.removal.rst
Original file line number Diff line number Diff line change
@@ -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.
16 changes: 4 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
from setuptools import setup, find_packages

install_requires = [
"execnet>=1.1",
"psutil>=3.0.0",
"pytest>=4.4.0",
"pytest-forked",
"six",
]
install_requires = ["execnet>=1.1", "psutil>=3.0.0", "pytest>=6.0.0", "pytest-forked"]


with open("README.rst") as f:
Expand All @@ -15,8 +9,7 @@
setup(
name="pytest-xdist",
use_scm_version={"write_to": "src/xdist/_version.py"},
description="pytest xdist plugin for distributed testing"
" and loop-on-failing modes",
description="pytest xdist plugin for distributed testing and loop-on-failing modes",
long_description=long_description,
license="MIT",
author="holger krekel and contributors",
Expand All @@ -30,7 +23,7 @@
"pytest11": ["xdist = xdist.plugin", "xdist.looponfail = xdist.looponfail"]
},
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,
setup_requires=["setuptools_scm"],
classifiers=[
Expand All @@ -45,9 +38,8 @@
"Topic :: Software Development :: Quality Assurance",
"Topic :: Utilities",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
Expand Down
3 changes: 0 additions & 3 deletions src/xdist/dsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ def worker_workerready(self, node, workerinfo):
node.workerinfo["id"] = node.gateway.id
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)
if self.shuttingdown:
node.shutdown()
Expand Down
5 changes: 1 addition & 4 deletions src/xdist/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,11 @@ def pytest_addoption(parser):
)
group.addoption(
"--max-worker-restart",
"--max-slave-restart",
action="store",
default=None,
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",
"when crashed (set to zero to disable this feature)",
)
group.addoption(
"--dist",
Expand Down
3 changes: 0 additions & 3 deletions src/xdist/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,5 @@ def setup_config(config, basetemp):
config._parser.prog = os.path.basename(workerinput["mainargv"][0])
config.workerinput = workerinput
config.workeroutput = {}
# TODO: deprecated name, backward compatibility only. Remove it in future
config.slaveinput = config.workerinput

This comment has been minimized.

Copy link
@zzzeek

zzzeek Aug 14, 2020

this never emitted any deprecation warning, so I had no idea this terminology was changed. it's of course a good change but I'm having to scramble on a friday to get all my machines working again. Consider emitting deprecation warnings in the future, thanks!

This comment has been minimized.

Copy link
@graingert

graingert Aug 14, 2020

Member

@zzzeek this was released in a major version, it's recommended to use a semver version range: pytest-xdist~=1.34 or pytest-xdist~=2.0

This comment has been minimized.

Copy link
@zzzeek

zzzeek Aug 14, 2020

if i pinned this package then id be on an ancient version by now and other things would be breaking. pytest itself emits deprecation warnings for major upcoming API changes.

This comment has been minimized.

Copy link
@nicoddemus

nicoddemus Aug 14, 2020

Member

@zzzeek you are definitely correct. I guess this was not done here because pytest-xdist doesn't have a history of deprecating things so we didn't even consider, but yeah it was a slip up on our part.

We will make sure to emit proper warnings for deprecations in the future. 👍

This comment has been minimized.

Copy link
@zzzeek

zzzeek Aug 14, 2020

i really should have checked this when we did our own terminology change a few months ago, not sure if I considered putting up a ticket but as you know it gets a lot of complaints when you make this change....all good now thanks!

config.slaveoutput = config.workeroutput
interactor = WorkerInteractor(config, channel)
config.hook.pytest_cmdline_main(config=config)
6 changes: 1 addition & 5 deletions src/xdist/workermanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,9 @@ def __init__(self, nodemanager, gateway, config, putevent):
self.workerinput = {
"workerid": gateway.id,
"workercount": len(nodemanager.specs),
"slaveid": gateway.id,
"slavecount": len(nodemanager.specs),
"testrunuid": nodemanager.testrunuid,
"mainargv": sys.argv,
}
# 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)
Expand Down Expand Up @@ -333,7 +329,7 @@ def process_from_remote(self, eventcall): # noqa too complex
self.notify_inproc(eventname, node=self, **kwargs)
elif eventname == "workerfinished":
self._down = True
self.workeroutput = self.slaveoutput = kwargs["workeroutput"]
self.workeroutput = kwargs["workeroutput"]
self.notify_inproc("workerfinished", node=self)
elif eventname in ("logstart", "logfinish"):
self.notify_inproc(eventname, node=self, **kwargs)
Expand Down
16 changes: 0 additions & 16 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,6 @@ def pytest_load_initial_conftests(early_config):
result.stderr.fnmatch_lines(["--foobar=123 active! *"])
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):
testdir.makeconftest(
"""
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist=
linting
py{27,35,36,37,38}-pytestlatest
py{35,36,37,38}-pytestlatest
py38-pytestmaster

[testenv]
Expand Down

0 comments on commit de3e54f

Please sign in to comment.