Skip to content

Commit 0ade9e4

Browse files
committed
Tests: Explicitly set multiprocessing start method to "fork"
By using multiprocessing's ForkProcess, the testsuite will also start working on macOS again, even on Python 3.8+. The background on this is that beginning with Python 3.8+, "fork" is not the default on all platforms anymore but has been changed to "spawn" on macOS. This method, however, apparently is not compatible with how multiprocessing is currently used within the test harness.
1 parent 973658c commit 0ade9e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/crate/client/test_http.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
import random
3030
import traceback
3131
from http.server import BaseHTTPRequestHandler, HTTPServer
32+
from multiprocessing.context import ForkProcess
3233
from unittest import TestCase
3334
from unittest.mock import patch, MagicMock
3435
from threading import Thread, Event
35-
from multiprocessing import Process
3636
from decimal import Decimal
3737
import datetime as dt
3838
import urllib3.exceptions
@@ -396,7 +396,7 @@ class KeepAliveClientTest(TestCase):
396396

397397
def __init__(self, *args, **kwargs):
398398
super(KeepAliveClientTest, self).__init__(*args, **kwargs)
399-
self.server_process = Process(target=self._run_server)
399+
self.server_process = ForkProcess(target=self._run_server)
400400

401401
def setUp(self):
402402
super(KeepAliveClientTest, self).setUp()
@@ -529,8 +529,8 @@ def __init__(self, *args, **kwargs):
529529
super().__init__(*args, **kwargs)
530530
self.assertIsNotNone(self.request_handler)
531531
self.server_address = ('127.0.0.1', random.randint(65000, 65535))
532-
self.server_process = Process(target=TestingHTTPServer.run_server,
533-
args=(self.server_address, self.request_handler))
532+
self.server_process = ForkProcess(target=TestingHTTPServer.run_server,
533+
args=(self.server_address, self.request_handler))
534534

535535
def setUp(self):
536536
self.server_process.start()

0 commit comments

Comments
 (0)