Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 3 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
13 changes: 9 additions & 4 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 = """
Expand Down