diff --git a/xdist/plugin.py b/xdist/plugin.py index dc3635e..971ed6c 100644 --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -4,8 +4,15 @@ import pytest def parse_numprocesses(s): if s == 'auto': - import multiprocessing - return multiprocessing.cpu_count() + try: + 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: return int(s)