add support for --boxed by aliasing to --forked of pytest-foked

This commit is contained in:
Ronny Pfannschmidt
2017-08-04 21:31:01 +02:00
parent 56d62c2d37
commit 5db31f1ee7
2 changed files with 10 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ from sys import version_info
from setuptools import setup, find_packages 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): if version_info < (2, 7):
install_requires.append('ordereddict') install_requires.append('ordereddict')

View File

@@ -26,10 +26,10 @@ def pytest_addoption(parser):
help="shortcut for '--dist=load --tx=NUM*popen', " help="shortcut for '--dist=load --tx=NUM*popen', "
"you can use 'auto' here for auto detection CPUs number on " "you can use 'auto' here for auto detection CPUs number on "
"host system") "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 " help="maximum number of slaves that can be restarted "
"when crashed (set to zero to disable this feature)") "when crashed (set to zero to disable this feature)")
group._addoption( group.addoption(
'--dist', metavar="distmode", '--dist', metavar="distmode",
action="store", choices=['each', 'load', 'loadscope', 'no'], action="store", choices=['each', 'load', 'loadscope', 'no'],
dest="dist", default="no", dest="dist", default="no",
@@ -40,7 +40,7 @@ def pytest_addoption(parser):
"loadscope: load balance by sending pending groups of tests in" "loadscope: load balance by sending pending groups of tests in"
" the same scope to any available environment.\n\n" " the same scope to any available environment.\n\n"
"(default) no: run tests inprocess, don't distribute.")) "(default) no: run tests inprocess, don't distribute."))
group._addoption( group.addoption(
'--tx', dest="tx", action="append", default=[], '--tx', dest="tx", action="append", default=[],
metavar="xspec", metavar="xspec",
help=("add a test execution environment. some examples: " help=("add a test execution environment. some examples: "
@@ -57,6 +57,9 @@ def pytest_addoption(parser):
'--rsyncignore', action="append", default=[], metavar="GLOB", '--rsyncignore', action="append", default=[], metavar="GLOB",
help="add expression for ignores when rsyncing to remote tx nodes.") 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( parser.addini(
'rsyncdirs', 'list of (relative) paths to be rsynced for' 'rsyncdirs', 'list of (relative) paths to be rsynced for'
' remote distributed testing.', type="pathlist") ' remote distributed testing.', type="pathlist")
@@ -67,6 +70,7 @@ def pytest_addoption(parser):
"looponfailroots", type="pathlist", "looponfailroots", type="pathlist",
help="directories to check for changes", default=[py.path.local()]) help="directories to check for changes", default=[py.path.local()])
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# distributed testing hooks # distributed testing hooks
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
@@ -93,6 +97,8 @@ def pytest_configure(config):
config.pluginmanager.register(session, "dsession") config.pluginmanager.register(session, "dsession")
tr = config.pluginmanager.getplugin("terminalreporter") tr = config.pluginmanager.getplugin("terminalreporter")
tr.showfspath = False tr.showfspath = False
if config.getoption("boxed"):
config.option.forked = True
@pytest.mark.tryfirst @pytest.mark.tryfirst