Skip to content

Commit 2683554

Browse files
test_multiprocessing_safety.py comment & naming cleanup
1 parent 64c6904 commit 2683554

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/geophires_x_client_tests/test_multiprocessing_safety.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from logging.handlers import QueueHandler
77
from queue import Empty
88

9-
# Important: We must be able to import the client and all parameter classes
109
from geophires_x_client import GeophiresXClient
1110
from geophires_x_client.geophires_input_parameters import EndUseOption
1211
from geophires_x_client.geophires_input_parameters import ImmutableGeophiresInputParameters
@@ -15,8 +14,9 @@
1514
def run_client_in_process(params_dict: dict, log_queue: multiprocessing.Queue, result_queue: multiprocessing.Queue):
1615
"""
1716
This is the function that each worker process will execute.
18-
It must be a top-level function to be picklable by multiprocessing.
17+
It must be a top-level function to be pickleable by multiprocessing.
1918
"""
19+
2020
# Configure logging for this worker process to send messages to the shared queue.
2121
root_logger = logging.getLogger()
2222
root_logger.setLevel(logging.INFO)
@@ -32,7 +32,7 @@ def run_client_in_process(params_dict: dict, log_queue: multiprocessing.Queue, r
3232
result_queue.put(e)
3333

3434

35-
class TestMultiprocessingSafety(unittest.TestCase):
35+
class MultiprocessingSafetyTestCase(unittest.TestCase):
3636
def setUp(self):
3737
"""Set up a unique set of parameters for each test."""
3838
self.params_dict = {
@@ -48,14 +48,15 @@ def setUp(self):
4848
def test_client_runs_real_geophires_and_caches_across_processes(self):
4949
"""
5050
Tests that GeophiresXClient can run the real geophires.main in multiple
51-
processes and that the cache is shared between them. This test is now
51+
processes and that the cache is shared between them. This test is
5252
fully self-contained to prevent resource conflicts with the test runner.
5353
"""
54+
5455
if sys.platform == 'win32':
5556
self.skipTest("The 'fork' multiprocessing context is not available on Windows.")
5657

5758
ctx = multiprocessing.get_context('fork')
58-
# Use the Manager as a context manager. This is the key to ensuring
59+
# Use the Manager as a context manager. This is key to ensuring
5960
# all resources it creates (queues, etc.) are properly shut down
6061
# at the end of the block, preventing deadlocks.
6162
with ctx.Manager() as manager:
@@ -79,7 +80,7 @@ def test_client_runs_real_geophires_and_caches_across_processes(self):
7980
for p in processes:
8081
p.start()
8182

82-
# --- Robust Result Collection ---
83+
# --- Result Collection ---
8384
results = []
8485
for i in range(num_processes):
8586
try:

0 commit comments

Comments
 (0)