|
11 | 11 | from pytask import main |
12 | 12 | from pytask import Task |
13 | 13 | from pytask_parallel.backends import PARALLEL_BACKENDS |
| 14 | +from pytask_parallel.backends import ParallelBackendChoices |
14 | 15 | from pytask_parallel.execute import _Sleeper |
15 | 16 | from pytask_parallel.execute import DefaultBackendNameSpace |
16 | 17 | from pytask_parallel.execute import ProcessesNameSpace |
@@ -129,9 +130,9 @@ def myfunc(): |
129 | 130 | session.config["_parallel_executor"] = executor |
130 | 131 |
|
131 | 132 | backend_name_space = { |
132 | | - "processes": ProcessesNameSpace, |
133 | | - "threads": DefaultBackendNameSpace, |
134 | | - "loky": DefaultBackendNameSpace, |
| 133 | + ParallelBackendChoices.PROCESSES: ProcessesNameSpace, |
| 134 | + ParallelBackendChoices.THREADS: DefaultBackendNameSpace, |
| 135 | + ParallelBackendChoices.LOKY: DefaultBackendNameSpace, |
135 | 136 | }[parallel_backend] |
136 | 137 |
|
137 | 138 | future = backend_name_space.pytask_execute_task(session, task) |
@@ -269,7 +270,11 @@ def task_example(produces): |
269 | 270 | @pytest.mark.parametrize( |
270 | 271 | "parallel_backend", |
271 | 272 | # Capturing warnings is not thread-safe. |
272 | | - [backend for backend in PARALLEL_BACKENDS if backend != "threads"], |
| 273 | + [ |
| 274 | + backend |
| 275 | + for backend in PARALLEL_BACKENDS |
| 276 | + if backend != ParallelBackendChoices.THREADS |
| 277 | + ], |
273 | 278 | ) |
274 | 279 | def test_collect_warnings_from_parallelized_tasks(runner, tmp_path, parallel_backend): |
275 | 280 | source = """ |
|
0 commit comments