summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2015-09-12 20:58:26 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2015-09-14 22:52:04 +0200
commit2425f6fda099a2134dbf72c8a30270cc9a659f1e (patch)
treefe4d795cecde6a46e4bb691714e8ca7e2202dddd /django/test
parent64d7a553e1be20174b0aa2882111049abf392d4f (diff)
Prevented --parallel from crashing on Windows.
Since --parallel is documented not to work on Windows, it's better to ignore it and run without parallelization than to crash. For example this could simplify cross-platform test scripts.
Diffstat (limited to 'django/test')
-rw-r--r--django/test/runner.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/test/runner.py b/django/test/runner.py
index 1baad7c622..97fadedbc4 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -211,6 +211,11 @@ def default_test_processes():
"""
Default number of test processes when using the --parallel option.
"""
+ # The current implementation of the parallel test runner requires
+ # multiprocessing to start subprocesses with fork().
+ # On Python 3.4+: if multiprocessing.get_start_method() != 'fork':
+ if not hasattr(os, 'fork'):
+ return 1
try:
return int(os.environ['DJANGO_TEST_PROCESSES'])
except KeyError: