From a06e75cc7816dc06092fe02ed594e4834184c2c1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 21 Jul 2018 12:09:44 -0300 Subject: [PATCH] Fix flake8 issue --- changelog/9.bugfix | 2 +- xdist/plugin.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changelog/9.bugfix b/changelog/9.bugfix index 404609a..7952d27 100644 --- a/changelog/9.bugfix +++ b/changelog/9.bugfix @@ -1 +1 @@ -Fix issue of virtualized or containerized environments not reporting the number of CPUs correctly +Fix issue of virtualized or containerized environments not reporting the number of CPUs correctly. diff --git a/xdist/plugin.py b/xdist/plugin.py index f172b80..278b65d 100644 --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -6,13 +6,14 @@ def parse_numprocesses(s): if s == 'auto': try: from os import sched_getaffinity - def cpu_count(): - return len(sched_getaffinity(0)) except ImportError: try: from os import cpu_count except ImportError: from multiprocessing import cpu_count + else: + def cpu_count(): + return len(sched_getaffinity(0)) try: n = cpu_count()