Avoid soft-deprecated pathlist ini type on pytest>=7
This allows the test suite to succeed with the legacypath plugin blocked. Fix #722.
This commit is contained in:
1
changelog/722.feature.rst
Normal file
1
changelog/722.feature.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Full compatibility with pytest 7 - no deprecation warnings or use of legacy features.
|
||||||
@@ -38,7 +38,7 @@ def pytest_cmdline_main(config):
|
|||||||
|
|
||||||
def looponfail_main(config):
|
def looponfail_main(config):
|
||||||
remotecontrol = RemoteControl(config)
|
remotecontrol = RemoteControl(config)
|
||||||
rootdirs = config.getini("looponfailroots")
|
rootdirs = [py.path.local(root) for root in config.getini("looponfailroots")]
|
||||||
statrecorder = StatRecorder(rootdirs)
|
statrecorder = StatRecorder(rootdirs)
|
||||||
try:
|
try:
|
||||||
while 1:
|
while 1:
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import py
|
import py
|
||||||
import pytest
|
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
|
_sys_path = list(sys.path) # freeze a copy of sys.path at interpreter startup
|
||||||
|
|
||||||
|
|
||||||
@@ -147,18 +151,18 @@ def pytest_addoption(parser):
|
|||||||
parser.addini(
|
parser.addini(
|
||||||
"rsyncdirs",
|
"rsyncdirs",
|
||||||
"list of (relative) paths to be rsynced for remote distributed testing.",
|
"list of (relative) paths to be rsynced for remote distributed testing.",
|
||||||
type="pathlist",
|
type="paths" if PYTEST_GTE_7 else "pathlist",
|
||||||
)
|
)
|
||||||
parser.addini(
|
parser.addini(
|
||||||
"rsyncignore",
|
"rsyncignore",
|
||||||
"list of (relative) glob-style paths to be ignored for rsyncing.",
|
"list of (relative) glob-style paths to be ignored for rsyncing.",
|
||||||
type="pathlist",
|
type="paths" if PYTEST_GTE_7 else "pathlist",
|
||||||
)
|
)
|
||||||
parser.addini(
|
parser.addini(
|
||||||
"looponfailroots",
|
"looponfailroots",
|
||||||
type="pathlist",
|
type="paths" if PYTEST_GTE_7 else "pathlist",
|
||||||
help="directories to check for changes",
|
help="directories to check for changes",
|
||||||
default=[py.path.local()],
|
default=[Path.cwd() if PYTEST_GTE_7 else py.path.local()],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ class NodeManager:
|
|||||||
def _getrsyncoptions(self):
|
def _getrsyncoptions(self):
|
||||||
"""Get options to be passed for rsync."""
|
"""Get options to be passed for rsync."""
|
||||||
ignores = list(self.DEFAULT_IGNORES)
|
ignores = list(self.DEFAULT_IGNORES)
|
||||||
ignores += self.config.option.rsyncignore
|
ignores += [str(path) for path in self.config.option.rsyncignore]
|
||||||
ignores += self.config.getini("rsyncignore")
|
ignores += [str(path) for path in self.config.getini("rsyncignore")]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ignores": ignores,
|
"ignores": ignores,
|
||||||
|
|||||||
Reference in New Issue
Block a user