Added error handling to -n auto.
This commit is contained in:
@@ -4,8 +4,15 @@ import pytest
|
|||||||
|
|
||||||
def parse_numprocesses(s):
|
def parse_numprocesses(s):
|
||||||
if s == 'auto':
|
if s == 'auto':
|
||||||
import multiprocessing
|
try:
|
||||||
return multiprocessing.cpu_count()
|
from os import cpu_count
|
||||||
|
except ImportError:
|
||||||
|
from multiprocessing import cpu_count
|
||||||
|
try:
|
||||||
|
n = cpu_count()
|
||||||
|
except NotImplementedError:
|
||||||
|
return 1
|
||||||
|
return n if n else 1
|
||||||
else:
|
else:
|
||||||
return int(s)
|
return int(s)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user