From dbaf49cd693c96910cd45886772aef6ade785a43 Mon Sep 17 00:00:00 2001 From: Max Linke Date: Thu, 22 Jun 2017 21:24:57 +0200 Subject: [PATCH] add '--numprocesses' as long option for '-n' This is more verbose in scripts that run pytest-xdist. It can also help in some ci-helper scripts like to auto detect if pytest-xdist should be installed. --- changelog/168.feature | 1 + testing/test_plugin.py | 4 ++++ xdist/plugin.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/168.feature diff --git a/changelog/168.feature b/changelog/168.feature new file mode 100644 index 0000000..aaa2175 --- /dev/null +++ b/changelog/168.feature @@ -0,0 +1 @@ +Add long option `--numprocesses` as alternative for `-n`. diff --git a/testing/test_plugin.py b/testing/test_plugin.py index 189a1bf..0406be7 100644 --- a/testing/test_plugin.py +++ b/testing/test_plugin.py @@ -20,6 +20,10 @@ def test_dist_options(testdir): check_options(config) assert config.option.dist == "load" assert config.option.tx == ['popen'] * 2 + config = testdir.parseconfigure("--numprocesses 2") + check_options(config) + assert config.option.dist == "load" + assert config.option.tx == ['popen'] * 2 config = testdir.parseconfigure("-d") check_options(config) assert config.option.dist == "load" diff --git a/xdist/plugin.py b/xdist/plugin.py index dc721da..b47cbe8 100644 --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -20,7 +20,7 @@ def parse_numprocesses(s): def pytest_addoption(parser): group = parser.getgroup("xdist", "distributed and subprocess testing") group._addoption( - '-n', dest="numprocesses", metavar="numprocesses", + '-n', '--numprocesses', dest="numprocesses", metavar="numprocesses", action="store", type=parse_numprocesses, help="shortcut for '--dist=load --tx=NUM*popen', "