Commit 0f3061bc authored by Jason Madden's avatar Jason Madden

Refactor known_failures.py to use a compact DSL instead of deeply nested conditions.

Part of #1367
parent 48f6b449
Refactor ``known_failures.py`` to use a compact DSL instead of deeply
nested condition statements.
......@@ -13,15 +13,17 @@ monkey.patch_all()
from .sysinfo import RUNNING_ON_APPVEYOR
from .sysinfo import PY37
from .sysinfo import PYPY3
from .patched_tests_setup import disable_tests_in_source
from . import support
from . import resources
from . import SkipTest
from . import util
if RUNNING_ON_APPVEYOR and PY37:
if (RUNNING_ON_APPVEYOR and PY37) or PYPY3:
# 3.7 added a stricter mode for thread cleanup.
# It appears to be unstable on Windows (at least appveyor)
# and PyPy3
# and test_socket.py constantly fails with an extra thread
# on some random test. We disable it entirely.
# XXX: Figure out how to make a *definition* in ./support.py actually
......
......@@ -32,10 +32,11 @@ except (ImportError, OSError, IOError):
pass
TIMEOUT = 100 # seconds
DEFAULT_NWORKERS = int(os.environ.get('NWORKERS') or max(cpu_count() - 1, 4))
if DEFAULT_NWORKERS > 10:
AVAIL_NWORKERS = cpu_count() - 1
DEFAULT_NWORKERS = int(os.environ.get('NWORKERS') or max(AVAIL_NWORKERS, 4))
if DEFAULT_NWORKERS > 15:
DEFAULT_NWORKERS = 10
SUGGESTED_NWORKERS = DEFAULT_NWORKERS
if RUN_LEAKCHECKS:
# Capturing the stats takes time, and we run each
......@@ -149,7 +150,7 @@ class Runner(object):
def __call__(self):
util.log("Running tests in parallel with concurrency %s %s." % (
self._worker_count,
util._colorize('number', '(concurrency available: %d)' % SUGGESTED_NWORKERS)
util._colorize('number', '(concurrency available: %d)' % AVAIL_NWORKERS)
),)
# Setting global state, in theory we can be used multiple times.
# This is fine as long as we are single threaded and call these
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment