@@ -244,6 +244,16 @@ def test_reconnet_fails(self):
244244
245245
246246class TestWatch (EtcdIntegrationTest ):
247+ # On macOS and newly non-macOS POSIX systems (since Python 3.14),
248+ # the default method has been changed to forkserver.
249+ # The code in this test does not work with it,
250+ # hence the explicit change to 'fork'
251+ # See https://github.com/python/cpython/issues/125714
252+ if multiprocessing .get_start_method () == "forkserver" :
253+ _mp_context = multiprocessing .get_context (method = "fork" )
254+ else :
255+ _mp_context = multiprocessing .get_context ()
256+
247257 def test_watch (self ):
248258 """INTEGRATION: Receive a watch event from other process"""
249259
@@ -259,15 +269,15 @@ def watch_value(key, queue):
259269 c = etcd .Client (port = 6001 )
260270 queue .put (c .watch (key ).value )
261271
262- changer = multiprocessing .Process (
272+ changer = self . _mp_context .Process (
263273 target = change_value ,
264274 args = (
265275 "/test-key" ,
266276 "new-test-value" ,
267277 ),
268278 )
269279
270- watcher = multiprocessing .Process (target = watch_value , args = ("/test-key" , queue ))
280+ watcher = self . _mp_context .Process (target = watch_value , args = ("/test-key" , queue ))
271281
272282 watcher .start ()
273283 time .sleep (1 )
@@ -301,15 +311,15 @@ def watch_value(key, index, queue):
301311 for i in range (0 , 3 ):
302312 queue .put (c .watch (key , index = index + i ).value )
303313
304- proc = multiprocessing .Process (
314+ proc = self . _mp_context .Process (
305315 target = change_value ,
306316 args = (
307317 "/test-key" ,
308318 "test-value3" ,
309319 ),
310320 )
311321
312- watcher = multiprocessing .Process (
322+ watcher = self . _mp_context .Process (
313323 target = watch_value , args = ("/test-key" , original_index , queue )
314324 )
315325
@@ -346,9 +356,9 @@ def watch_value(key, queue):
346356 event = next (c .eternal_watch (key )).value
347357 queue .put (event )
348358
349- changer = multiprocessing .Process (target = change_value , args = ("/test-key" ,))
359+ changer = self . _mp_context .Process (target = change_value , args = ("/test-key" ,))
350360
351- watcher = multiprocessing .Process (target = watch_value , args = ("/test-key" , queue ))
361+ watcher = self . _mp_context .Process (target = watch_value , args = ("/test-key" , queue ))
352362
353363 watcher .start ()
354364 changer .start ()
@@ -383,15 +393,15 @@ def watch_value(key, index, queue):
383393 for i in range (0 , 3 ):
384394 queue .put (next (iterevents ).value )
385395
386- proc = multiprocessing .Process (
396+ proc = self . _mp_context .Process (
387397 target = change_value ,
388398 args = (
389399 "/test-key" ,
390400 "test-value3" ,
391401 ),
392402 )
393403
394- watcher = multiprocessing .Process (
404+ watcher = self . _mp_context .Process (
395405 target = watch_value , args = ("/test-key" , original_index , queue )
396406 )
397407
0 commit comments