From 1fbf49909ff9b2c33305295835caf1453fd4ae27 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 21 Oct 2022 19:13:06 -0300 Subject: [PATCH] Remove --boxed and pytest-forked dependency Fixes #468 Fixes #543 --- CHANGELOG.rst | 2 +- changelog/468.removal.rst | 1 + changelog/468.trivial.rst | 1 + docs/boxed.rst | 9 --------- docs/index.rst | 1 - setup.cfg | 1 - src/xdist/plugin.py | 13 ------------- src/xdist/workermanage.py | 1 - testing/acceptance_test.py | 3 +-- testing/test_plugin.py | 16 ---------------- 10 files changed, 4 insertions(+), 44 deletions(-) create mode 100644 changelog/468.removal.rst create mode 100644 changelog/468.trivial.rst delete mode 100644 docs/boxed.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d218ba55..c2d680a4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ pytest-xdist 2.5.0 (2021-12-10) Deprecations and Removals ------------------------- -- `#468 `_: The ``--boxed`` command line argument is deprecated. Install pytest-forked and use ``--forked`` instead. pytest-xdist 3.0.0 will remove the ``--boxed`` argument and pytest-forked dependency. +- `#468 `_: The ``--boxed`` command line argument is deprecated. Install `pytest-forked `__ and use ``--forked`` instead. pytest-xdist 3.0.0 will remove the ``--boxed`` argument and ``pytest-forked`` dependency. Features diff --git a/changelog/468.removal.rst b/changelog/468.removal.rst new file mode 100644 index 00000000..c4bdfc2a --- /dev/null +++ b/changelog/468.removal.rst @@ -0,0 +1 @@ +The ``--boxed`` command-line option has been removed. If you still need this functionality, install `pytest-forked `__ separately. diff --git a/changelog/468.trivial.rst b/changelog/468.trivial.rst new file mode 100644 index 00000000..51045930 --- /dev/null +++ b/changelog/468.trivial.rst @@ -0,0 +1 @@ +The ``py`` dependency has been dropped. diff --git a/docs/boxed.rst b/docs/boxed.rst deleted file mode 100644 index ec02bd57..00000000 --- a/docs/boxed.rst +++ /dev/null @@ -1,9 +0,0 @@ - -.. _boxed: - -Running tests in a boxed subprocess (moved to pytest-forked) -============================================================ - -This functionality has been moved to the -`pytest-forked `_ plugin, but the ``--boxed`` option -is still kept for backward compatibility. diff --git a/docs/index.rst b/docs/index.rst index 6e8e6112..b7b8d139 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -55,7 +55,6 @@ Features distribution subprocess - boxed remote crash how-to diff --git a/setup.cfg b/setup.cfg index 4994681a..88871d11 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,7 +44,6 @@ python_requires = >=3.6 install_requires = execnet>=1.1 pytest>=6.2.0 - pytest-forked setup_requires = # left empty, enforce using isolated build system [options.packages.find] diff --git a/src/xdist/plugin.py b/src/xdist/plugin.py index d73d9eb9..f530b361 100644 --- a/src/xdist/plugin.py +++ b/src/xdist/plugin.py @@ -134,11 +134,6 @@ def pytest_addoption(parser): metavar="GLOB", help="add expression for ignores when rsyncing to remote tx nodes.", ) - group.addoption( - "--boxed", - action="store_true", - help="backward compatibility alias for pytest-forked --forked", - ) group.addoption( "--testrunuid", action="store", @@ -195,14 +190,6 @@ def pytest_configure(config): tr = config.pluginmanager.getplugin("terminalreporter") if tr: tr.showfspath = False - if config.getoption("boxed"): - warning = DeprecationWarning( - "The --boxed command line argument is deprecated. " - "Install pytest-forked and use --forked instead. " - "pytest-xdist 3.0.0 will remove the --boxed argument and pytest-forked dependency." - ) - config.issue_config_time_warning(warning, 2) - config.option.forked = True config_line = ( "xdist_group: specify group for tests should run in same session." diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py index 10f1a481..a940b84c 100644 --- a/src/xdist/workermanage.py +++ b/src/xdist/workermanage.py @@ -6,7 +6,6 @@ from pathlib import Path from typing import List, Union, Sequence, Optional, Any, Tuple, Set -import py import pytest import execnet diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 05bd9bf6..94129f1d 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -602,11 +602,10 @@ def test_1(request): def test_crashing_item(pytester, when) -> None: """Ensure crashing item is correctly reported during all testing stages""" code = dict(setup="", call="", teardown="") - code[when] = "py.process.kill(os.getpid())" + code[when] = "os._exit(1)" p = pytester.makepyfile( """ import os - import py import pytest @pytest.fixture diff --git a/testing/test_plugin.py b/testing/test_plugin.py index e50c0cd9..782d96c4 100644 --- a/testing/test_plugin.py +++ b/testing/test_plugin.py @@ -122,22 +122,6 @@ def pytest_xdist_auto_num_workers(): assert config.getoption("numprocesses") == 42 -def test_boxed_with_collect_only(pytester: pytest.Pytester) -> None: - from xdist.plugin import pytest_cmdline_main as check_options - - config = pytester.parseconfigure("-n1", "--boxed") - check_options(config) - assert config.option.forked - - config = pytester.parseconfigure("-n1", "--collect-only") - check_options(config) - assert not config.option.forked - - config = pytester.parseconfigure("-n1", "--boxed", "--collect-only") - check_options(config) - assert config.option.forked - - def test_dsession_with_collect_only(pytester: pytest.Pytester) -> None: from xdist.plugin import pytest_cmdline_main as check_options from xdist.plugin import pytest_configure as configure