Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

Commit 443d324

Browse files
committed
fixed multiprocessing in tests
1 parent 3e16ec9 commit 443d324

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/system/test_system.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,9 @@ def test_log_handler_otel_integration(self):
721721
self.assertTrue(entries[0].trace_sampled, expected_tracesampled)
722722

723723
def test_log_handler_close(self):
724-
from multiprocessing import Process
724+
import multiprocessing
725725

726+
ctx = multiprocessing.get_context('fork')
726727
LOG_MESSAGE = "This is a test of handler.close before exiting."
727728
LOGGER_NAME = "close-test"
728729
handler_name = self._logger_name(LOGGER_NAME)
@@ -746,16 +747,17 @@ def subprocess_main():
746747
cloud_logger.warning(LOG_MESSAGE)
747748
handler.close()
748749

749-
proc = Process(target=subprocess_main)
750+
proc = ctx.Process(target=subprocess_main)
750751
proc.start()
751752
proc.join()
752753
entries = _list_entries(logger)
753754
self.assertEqual(len(entries), 1)
754755
self.assertEqual(entries[0].payload, LOG_MESSAGE)
755756

756757
def test_log_client_flush_handlers(self):
757-
from multiprocessing import Process
758+
import multiprocessing
758759

760+
ctx = multiprocessing.get_context('fork')
759761
LOG_MESSAGE = "This is a test of client.flush_handlers before exiting."
760762
LOGGER_NAME = "close-test"
761763
handler_name = self._logger_name(LOGGER_NAME)
@@ -779,7 +781,7 @@ def subprocess_main():
779781
cloud_logger.warning(LOG_MESSAGE)
780782
Config.CLIENT.flush_handlers()
781783

782-
proc = Process(target=subprocess_main)
784+
proc = ctx.Process(target=subprocess_main)
783785
proc.start()
784786
proc.join()
785787
entries = _list_entries(logger)

0 commit comments

Comments
 (0)