From ab5bbaea511994a543de84bf4d2197551a45142b Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 26 Nov 2020 11:30:46 -0800 Subject: If we are not on Windows use fork for multiprocessing This speeds up the test suite significantly by reducing the overhead of spawning a new process. --- tests/test_functional.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, -- cgit v1.2.1