Skip to content

Commit 8b0856a

Browse files
committed
Deprecate looponfail plugin
Fix #826
1 parent f206487 commit 8b0856a

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

changelog/826.deprecation.rst

Whitespace-only changes.

pyproject.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ template = "changelog/_template.rst"
1919

2020
[[tool.towncrier.type]]
2121
directory = "removal"
22-
name = "Deprecations and Removals"
22+
name = "Removals"
23+
showcontent = true
24+
25+
[[tool.towncrier.type]]
26+
directory = "deprecation"
27+
name = "Deprecations"
2328
showcontent = true
2429

2530
[[tool.towncrier.type]]

src/xdist/looponfail.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ def pytest_cmdline_main(config):
4646

4747
def looponfail_main(config: pytest.Config) -> None:
4848
remotecontrol = RemoteControl(config)
49-
rootdirs = [Path(root) for root in config.getini("looponfailroots")]
49+
config_roots = config.getini("looponfailroots")
50+
if not config_roots:
51+
config_roots = [Path.cwd()]
52+
rootdirs = [Path(root) for root in config_roots]
5053
statrecorder = StatRecorder(rootdirs)
5154
try:
5255
while 1:

src/xdist/plugin.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import uuid
33
import sys
4-
from pathlib import Path
54

65
import pytest
76

@@ -158,8 +157,7 @@ def pytest_addoption(parser):
158157
parser.addini(
159158
"looponfailroots",
160159
type="paths" if PYTEST_GTE_7 else "pathlist",
161-
help="directories to check for changes",
162-
default=[Path.cwd()],
160+
help="directories to check for changes. Default: current directory.",
163161
)
164162

165163

@@ -191,6 +189,13 @@ def pytest_configure(config):
191189
if tr:
192190
tr.showfspath = False
193191

192+
if config.getoption("looponfail", None) or config.getini("looponfailroots"):
193+
warning = DeprecationWarning(
194+
"The --looponfail command line argument and looponfailroots config variable are deprecated.\n"
195+
"The loop-on-fail feature will be removed in pytest-xdist 4.0."
196+
)
197+
config.issue_config_time_warning(warning, 2)
198+
194199
config_line = (
195200
"xdist_group: specify group for tests should run in same session."
196201
"in relation to one another. " + "Provided by pytest-xdist."

testing/acceptance_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def test_ok():
740740
pass
741741
"""
742742
)
743-
result = pytester.runpytest(p1, "-n1", "-p", "no:%s" % plugin)
743+
result = pytester.runpytest(p1, "-n1", "-p", f"no:{plugin}")
744744
assert result.ret == 0
745745
result.stdout.fnmatch_lines("*1 passed*")
746746

0 commit comments

Comments
 (0)