diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73e9c23..498593e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: auto-update-conda: false python-version: ${{ matrix.python-version }} channels: conda-forge,nodefaults - mamba-version: "*" + miniforge-variant: Mambaforge - name: Install core dependencies. shell: bash -l {0} diff --git a/tests/test_config.py b/tests/test_config.py index 817713f..9f37753 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -35,16 +35,17 @@ def test_interplay_between_debugging_and_parallel(tmp_path, pdb, n_workers, expe ("parallel_backend", "unknown_backend", ExitCode.CONFIGURATION_FAILED), ] + [ - ("parallel_backend", parallel_backend.value, ExitCode.OK) + ("parallel_backend", parallel_backend, ExitCode.OK) for parallel_backend in ParallelBackendChoices ], ) def test_reading_values_from_config_file( tmp_path, configuration_option, value, exit_code ): + config_value = value.value if isinstance(value, ParallelBackendChoices) else value config = f""" [tool.pytask.ini_options] - {configuration_option} = {value!r} + {configuration_option} = {config_value!r} """ tmp_path.joinpath("pyproject.toml").write_text(textwrap.dedent(config)) diff --git a/tests/test_execute.py b/tests/test_execute.py index 959838c..fbad52a 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -11,6 +11,7 @@ from pytask import main from pytask import Task from pytask_parallel.backends import PARALLEL_BACKENDS +from pytask_parallel.backends import ParallelBackendChoices from pytask_parallel.execute import _Sleeper from pytask_parallel.execute import DefaultBackendNameSpace from pytask_parallel.execute import ProcessesNameSpace @@ -129,9 +130,9 @@ def myfunc(): session.config["_parallel_executor"] = executor backend_name_space = { - "processes": ProcessesNameSpace, - "threads": DefaultBackendNameSpace, - "loky": DefaultBackendNameSpace, + ParallelBackendChoices.PROCESSES: ProcessesNameSpace, + ParallelBackendChoices.THREADS: DefaultBackendNameSpace, + ParallelBackendChoices.LOKY: DefaultBackendNameSpace, }[parallel_backend] future = backend_name_space.pytask_execute_task(session, task) @@ -269,7 +270,11 @@ def task_example(produces): @pytest.mark.parametrize( "parallel_backend", # Capturing warnings is not thread-safe. - [backend for backend in PARALLEL_BACKENDS if backend != "threads"], + [ + backend + for backend in PARALLEL_BACKENDS + if backend != ParallelBackendChoices.THREADS + ], ) def test_collect_warnings_from_parallelized_tasks(runner, tmp_path, parallel_backend): source = """