summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2020-11-26 11:30:46 -0800
committerBert JW Regeer <bertjw@regeer.org>2020-11-26 11:30:46 -0800
commitab5bbaea511994a543de84bf4d2197551a45142b (patch)
treee06a61987130ea5c9da373865cbb063f15a12f41 /tests
parent31d7498c84cf0041f37beb503fd0ddf78d9d41e2 (diff)
downloadwaitress-ab5bbaea511994a543de84bf4d2197551a45142b.tar.gz
If we are not on Windows use fork for multiprocessingspeedup-test-suite
This speeds up the test suite significantly by reducing the overhead of spawning a new process.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_functional.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_functional.py b/tests/test_functional.py
index f8ceabf..04a2df4 100644
--- a/tests/test_functional.py
+++ b/tests/test_functional.py
@@ -12,6 +12,7 @@ import time
import unittest
from waitress import server
+from waitress.compat import WIN
from waitress.utilities import cleanup_unix_socket
dn = os.path.dirname
@@ -76,7 +77,12 @@ class SubprocessTests:
if "COVERAGE_RCFILE" in os.environ:
os.environ["COVERAGE_PROCESS_START"] = os.environ["COVERAGE_RCFILE"]
- self.proc = multiprocessing.Process(
+ if not WIN:
+ ctx = multiprocessing.get_context("fork")
+ else:
+ ctx = multiprocessing.get_context("spawn")
+
+ self.proc = ctx.Process(
target=start_server,
args=(target, self.server, self.queue),
kwargs=kw,