diff --git a/changelog/722.feature.rst b/changelog/722.feature.rst new file mode 100644 index 0000000..b8654ff --- /dev/null +++ b/changelog/722.feature.rst @@ -0,0 +1 @@ +Full compatibility with pytest 7 - no deprecation warnings or use of legacy features. diff --git a/src/xdist/looponfail.py b/src/xdist/looponfail.py index 5ce13a0..b721527 100644 --- a/src/xdist/looponfail.py +++ b/src/xdist/looponfail.py @@ -38,7 +38,7 @@ def pytest_cmdline_main(config): def looponfail_main(config): remotecontrol = RemoteControl(config) - rootdirs = config.getini("looponfailroots") + rootdirs = [py.path.local(root) for root in config.getini("looponfailroots")] statrecorder = StatRecorder(rootdirs) try: while 1: diff --git a/src/xdist/plugin.py b/src/xdist/plugin.py index 4f410cc..e65bb4a 100644 --- a/src/xdist/plugin.py +++ b/src/xdist/plugin.py @@ -1,10 +1,14 @@ import os import uuid import sys +from pathlib import Path import py import pytest + +PYTEST_GTE_7 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 0) # type: ignore[attr-defined] + _sys_path = list(sys.path) # freeze a copy of sys.path at interpreter startup @@ -147,18 +151,18 @@ def pytest_addoption(parser): parser.addini( "rsyncdirs", "list of (relative) paths to be rsynced for remote distributed testing.", - type="pathlist", + type="paths" if PYTEST_GTE_7 else "pathlist", ) parser.addini( "rsyncignore", "list of (relative) glob-style paths to be ignored for rsyncing.", - type="pathlist", + type="paths" if PYTEST_GTE_7 else "pathlist", ) parser.addini( "looponfailroots", - type="pathlist", + type="paths" if PYTEST_GTE_7 else "pathlist", help="directories to check for changes", - default=[py.path.local()], + default=[Path.cwd() if PYTEST_GTE_7 else py.path.local()], ) diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py index 4b576f9..411ea82 100644 --- a/src/xdist/workermanage.py +++ b/src/xdist/workermanage.py @@ -118,8 +118,8 @@ class NodeManager: def _getrsyncoptions(self): """Get options to be passed for rsync.""" ignores = list(self.DEFAULT_IGNORES) - ignores += self.config.option.rsyncignore - ignores += self.config.getini("rsyncignore") + ignores += [str(path) for path in self.config.option.rsyncignore] + ignores += [str(path) for path in self.config.getini("rsyncignore")] return { "ignores": ignores,