Skip to content

Commit 6c4ffef

Browse files
committed
Fix tests.
1 parent a807c01 commit 6c4ffef

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

tests/test_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ def test_interplay_between_debugging_and_parallel(tmp_path, pdb, n_workers, expe
3535
("parallel_backend", "unknown_backend", ExitCode.CONFIGURATION_FAILED),
3636
]
3737
+ [
38-
("parallel_backend", parallel_backend.value, ExitCode.OK)
38+
("parallel_backend", parallel_backend, ExitCode.OK)
3939
for parallel_backend in ParallelBackendChoices
4040
],
4141
)
4242
def test_reading_values_from_config_file(
4343
tmp_path, configuration_option, value, exit_code
4444
):
45+
config_value = value.value if isinstance(value, ParallelBackendChoices) else value
4546
config = f"""
4647
[tool.pytask.ini_options]
47-
{configuration_option} = {value!r}
48+
{configuration_option} = {config_value!r}
4849
"""
4950
tmp_path.joinpath("pyproject.toml").write_text(textwrap.dedent(config))
5051

tests/test_execute.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pytask import main
1212
from pytask import Task
1313
from pytask_parallel.backends import PARALLEL_BACKENDS
14+
from pytask_parallel.backends import ParallelBackendChoices
1415
from pytask_parallel.execute import _Sleeper
1516
from pytask_parallel.execute import DefaultBackendNameSpace
1617
from pytask_parallel.execute import ProcessesNameSpace
@@ -129,9 +130,9 @@ def myfunc():
129130
session.config["_parallel_executor"] = executor
130131

131132
backend_name_space = {
132-
"processes": ProcessesNameSpace,
133-
"threads": DefaultBackendNameSpace,
134-
"loky": DefaultBackendNameSpace,
133+
ParallelBackendChoices.PROCESSES: ProcessesNameSpace,
134+
ParallelBackendChoices.THREADS: DefaultBackendNameSpace,
135+
ParallelBackendChoices.LOKY: DefaultBackendNameSpace,
135136
}[parallel_backend]
136137

137138
future = backend_name_space.pytask_execute_task(session, task)
@@ -269,7 +270,11 @@ def task_example(produces):
269270
@pytest.mark.parametrize(
270271
"parallel_backend",
271272
# 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+
],
273278
)
274279
def test_collect_warnings_from_parallelized_tasks(runner, tmp_path, parallel_backend):
275280
source = """

0 commit comments

Comments
 (0)