Create new dist option 'loadgroup'

This commit is contained in:
baekdohyeop
2021-11-29 00:03:49 +09:00
parent 6d83034bb8
commit 52a395888f
6 changed files with 203 additions and 1 deletions

View File

@@ -86,7 +86,7 @@ def pytest_addoption(parser):
"--dist",
metavar="distmode",
action="store",
choices=["each", "load", "loadscope", "loadfile", "no"],
choices=["each", "load", "loadscope", "loadfile", "loadgroup", "no"],
dest="dist",
default="no",
help=(
@@ -98,6 +98,8 @@ def pytest_addoption(parser):
" the same scope to any available environment.\n\n"
"loadfile: load balance by sending test grouped by file"
" to any available environment.\n\n"
"loadgroup: load balance by sending any pending test or test group"
" to any available enviroment.\n\n"
"(default) no: run tests inprocess, don't distribute."
),
)
@@ -204,6 +206,12 @@ def pytest_configure(config):
config.issue_config_time_warning(warning, 2)
config.option.forked = True
config_line = (
"xgroup: specify group for tests should run in same session."
"in relation to one another. " + "Provided by pytest-xdist."
)
config.addinivalue_line("markers", config_line)
@pytest.hookimpl(tryfirst=True)
def pytest_cmdline_main(config):