Skip to content

Commit

Permalink
Deprecate looponfail plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Oct 22, 2022
1 parent f206487 commit 86e05fd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Empty file added changelog/826.deprecation.rst
Empty file.
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ template = "changelog/_template.rst"

[[tool.towncrier.type]]
directory = "removal"
name = "Deprecations and Removals"
name = "Removals"
showcontent = true

[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true

[[tool.towncrier.type]]
Expand Down
5 changes: 4 additions & 1 deletion src/xdist/looponfail.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def pytest_cmdline_main(config):

def looponfail_main(config: pytest.Config) -> None:
remotecontrol = RemoteControl(config)
rootdirs = [Path(root) for root in config.getini("looponfailroots")]
config_roots = config.getini("looponfailroots")
if not config_roots:
config_roots = [Path.cwd()]
rootdirs = [Path(root) for root in config_roots]
statrecorder = StatRecorder(rootdirs)
try:
while 1:
Expand Down
11 changes: 8 additions & 3 deletions src/xdist/plugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import uuid
import sys
from pathlib import Path

import pytest

Expand Down Expand Up @@ -158,8 +157,7 @@ def pytest_addoption(parser):
parser.addini(
"looponfailroots",
type="paths" if PYTEST_GTE_7 else "pathlist",
help="directories to check for changes",
default=[Path.cwd()],
help="directories to check for changes. Default: current directory.",
)


Expand Down Expand Up @@ -191,6 +189,13 @@ def pytest_configure(config):
if tr:
tr.showfspath = False

if config.getoption("looponfail") or config.getini("looponfailroots") is not None:
warning = DeprecationWarning(
"The --looponfail command line argument and looponfailroots config variable are deprecated.\n"
"The loop-on-fail feature will be removed in pytest-xdist 4.0."
)
config.issue_config_time_warning(warning, 2)

config_line = (
"xdist_group: specify group for tests should run in same session."
"in relation to one another. " + "Provided by pytest-xdist."
Expand Down

0 comments on commit 86e05fd

Please sign in to comment.