Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
771f248a04 | ||
|
|
c0c794b961 |
1
.hgtags
1
.hgtags
@@ -17,3 +17,4 @@ cd44a941c833c098e4899fe3d42a96703754d0d5 1.5
|
||||
4406fc2a6427fadc021ed7e43e7aa5032b1ea91f 1.10
|
||||
220f6e46eb71a6212ccbe6b67b9e6edcf8ee4fa5 1.11
|
||||
39ef85dbc893cc63dede11601208098a667b58e9 1.12
|
||||
4e25f4c568be2d7cb4d1739638a9e66bbf28f588 v1.13
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
1.13.1
|
||||
-------
|
||||
|
||||
- fix a regression -n 0 now disables xdist again
|
||||
|
||||
|
||||
1.13
|
||||
-------------------------
|
||||
|
||||
@@ -16,7 +22,7 @@
|
||||
- new "--max-slave-restart" option that can be used to control maximum
|
||||
number of times pytest-xdist can restart slaves due to crashes. Thanks to
|
||||
Anatoly Bubenkov for the report and Bruno Oliveira for the PR.
|
||||
|
||||
|
||||
- release as wheel
|
||||
|
||||
- "-n" option now can be set to "auto" for automatic detection of number
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
import multiprocessing
|
||||
|
||||
import py
|
||||
import pytest
|
||||
|
||||
|
||||
def parse_numprocesses(s):
|
||||
if s == 'auto':
|
||||
import multiprocessing
|
||||
return multiprocessing.cpu_count()
|
||||
else:
|
||||
return int(s)
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
group = parser.getgroup("xdist", "distributed and subprocess testing")
|
||||
group._addoption('-n', dest="numprocesses", metavar="numprocesses",
|
||||
action="store",
|
||||
type=parse_numprocesses,
|
||||
help="shortcut for '--dist=load --tx=NUM*popen', "
|
||||
"you can use 'auto' here for auto detection CPUs number on "
|
||||
"host system")
|
||||
@@ -68,13 +76,6 @@ def pytest_configure(config):
|
||||
@pytest.mark.tryfirst
|
||||
def pytest_cmdline_main(config):
|
||||
if config.option.numprocesses:
|
||||
if config.option.numprocesses == 'auto':
|
||||
config.option.numprocesses = multiprocessing.cpu_count()
|
||||
else:
|
||||
try:
|
||||
config.option.numprocesses = int(config.option.numprocesses)
|
||||
except ValueError:
|
||||
config.option.numprocesses = 1
|
||||
config.option.dist = "load"
|
||||
config.option.tx = ['popen'] * config.option.numprocesses
|
||||
if config.option.distload:
|
||||
|
||||
Reference in New Issue
Block a user