Skip to content

Commit ac0bb50

Browse files
committed
added mp method parameter to test_task
1 parent cda41a2 commit ac0bb50

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/integration/test_task.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import multiprocessing
12
import os
23
from functools import partial
34
from multiprocessing.pool import ThreadPool
@@ -51,10 +52,13 @@ def example_tasks(tmp_path):
5152
return tasks
5253

5354

55+
@pytest.mark.parametrize('mpmethod', ["spawn", "fork"])
5456
@pytest.mark.parametrize('max_parallel_tasks', [1, 2, 3, 4, 16, None])
55-
def test_run_tasks(monkeypatch, tmp_path, max_parallel_tasks, example_tasks):
57+
def test_run_tasks(monkeypatch, tmp_path, max_parallel_tasks, example_tasks,
58+
mpmethod):
5659
"""Check that tasks are run correctly."""
57-
60+
monkeypatch.setattr(esmvalcore._task, 'Pool',
61+
multiprocessing.get_context(mpmethod).Pool)
5862
example_tasks.run(max_parallel_tasks=max_parallel_tasks)
5963

6064
for task in example_tasks:

0 commit comments

Comments
 (0)