From 5db31f1ee7301700ae9c73b92d4c9d07fe01339a Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Fri, 4 Aug 2017 21:31:01 +0200 Subject: [PATCH] add support for --boxed by aliasing to --forked of pytest-foked --- setup.py | 2 +- xdist/plugin.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 9876aeb..7f8b057 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from sys import version_info from setuptools import setup, find_packages -install_requires = ['execnet>=1.1', 'pytest>=3.0.0'] +install_requires = ['execnet>=1.1', 'pytest>=3.0.0', 'pytest-forked'] if version_info < (2, 7): install_requires.append('ordereddict') diff --git a/xdist/plugin.py b/xdist/plugin.py index 47a9b54..1e41bb4 100644 --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -26,10 +26,10 @@ def pytest_addoption(parser): help="shortcut for '--dist=load --tx=NUM*popen', " "you can use 'auto' here for auto detection CPUs number on " "host system") - group._addoption('--max-slave-restart', action="store", default=None, + group.addoption('--max-slave-restart', action="store", default=None, help="maximum number of slaves that can be restarted " "when crashed (set to zero to disable this feature)") - group._addoption( + group.addoption( '--dist', metavar="distmode", action="store", choices=['each', 'load', 'loadscope', 'no'], dest="dist", default="no", @@ -40,7 +40,7 @@ def pytest_addoption(parser): "loadscope: load balance by sending pending groups of tests in" " the same scope to any available environment.\n\n" "(default) no: run tests inprocess, don't distribute.")) - group._addoption( + group.addoption( '--tx', dest="tx", action="append", default=[], metavar="xspec", help=("add a test execution environment. some examples: " @@ -57,6 +57,9 @@ def pytest_addoption(parser): '--rsyncignore', action="append", default=[], 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") parser.addini( 'rsyncdirs', 'list of (relative) paths to be rsynced for' ' remote distributed testing.', type="pathlist") @@ -67,6 +70,7 @@ def pytest_addoption(parser): "looponfailroots", type="pathlist", help="directories to check for changes", default=[py.path.local()]) + # ------------------------------------------------------------------------- # distributed testing hooks # ------------------------------------------------------------------------- @@ -93,6 +97,8 @@ def pytest_configure(config): config.pluginmanager.register(session, "dsession") tr = config.pluginmanager.getplugin("terminalreporter") tr.showfspath = False + if config.getoption("boxed"): + config.option.forked = True @pytest.mark.tryfirst