From 03b2f323920c9380e3e7ff8a2d3a20fe95c206b8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 20:37:17 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pygrep-hooks: v1.9.0 → v1.10.0](https://github.com/pre-commit/pygrep-hooks/compare/v1.9.0...v1.10.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.215 → v0.0.223](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.215...v0.0.223) - [github.com/dosisod/refurb: v1.9.1 → v1.10.0](https://github.com/dosisod/refurb/compare/v1.9.1...v1.10.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5669061..7947651 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: args: [--branch, main] - id: trailing-whitespace - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-check-blanket-noqa - id: python-check-mock-methods @@ -43,11 +43,11 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.215 + rev: v0.0.223 hooks: - id: ruff - repo: https://github.com/dosisod/refurb - rev: v1.9.1 + rev: v1.10.0 hooks: - id: refurb args: [--ignore, FURB126] From e8d3b1525700e9d1587b6c611af5fa39855f4406 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 20:39:39 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pytask_julia/collect.py | 8 ++++---- src/pytask_julia/config.py | 4 ++-- src/pytask_julia/execute.py | 2 +- tests/conftest.py | 2 +- tests/test_collect.py | 2 +- tests/test_execute.py | 26 ++++++++++++------------- tests/test_normal_execution_w_plugin.py | 2 +- tests/test_parallel.py | 10 +++++----- tests/test_parametrize.py | 8 ++++---- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/pytask_julia/collect.py b/src/pytask_julia/collect.py index 005b26a..edb2a1e 100644 --- a/src/pytask_julia/collect.py +++ b/src/pytask_julia/collect.py @@ -27,7 +27,7 @@ def run_jl_script( - script: Path, options: list[str], serialized: Path, project: list[str] + script: Path, options: list[str], serialized: Path, project: list[str], ) -> None: """Run a Julia script.""" cmd = ["julia"] + options + project + [_SEPARATOR, str(script), str(serialized)] @@ -37,7 +37,7 @@ def run_jl_script( @hookimpl def pytask_collect_task( - session: Session, path: Path, name: str, obj: Any + session: Session, path: Path, name: str, obj: Any, ) -> Task | None: """Collect a task which is a function. @@ -59,7 +59,7 @@ def pytask_collect_task( if len(marks) > 1: raise ValueError( f"Task {name!r} has multiple @pytask.mark.julia marks, but only one is " - "allowed." + "allowed.", ) julia_mark = _parse_julia_mark( @@ -90,7 +90,7 @@ def pytask_collect_task( ) script_node = session.hook.pytask_collect_node( - session=session, path=path, node=script + session=session, path=path, node=script, ) if isinstance(task.depends_on, dict): diff --git a/src/pytask_julia/config.py b/src/pytask_julia/config.py index 84b877d..1849fd3 100644 --- a/src/pytask_julia/config.py +++ b/src/pytask_julia/config.py @@ -16,11 +16,11 @@ def pytask_parse_config(config: dict[str, Any]) -> None: if config["julia_serializer"] not in SERIALIZERS: raise ValueError( f"'julia_serializer' is {config['julia_serializer']} and not one of " - f"{list(SERIALIZERS)}." + f"{list(SERIALIZERS)}.", ) config["julia_suffix"] = config.get("julia_suffix", "") config["julia_options"] = _parse_value_or_whitespace_option( - config.get("julia_options") + config.get("julia_options"), ) project = config.get("julia_project") if project is None: diff --git a/src/pytask_julia/execute.py b/src/pytask_julia/execute.py index d3680a7..d5e1064 100644 --- a/src/pytask_julia/execute.py +++ b/src/pytask_julia/execute.py @@ -22,7 +22,7 @@ def pytask_execute_task_setup(task: Task) -> None: if shutil.which("julia") is None: raise RuntimeError( "julia is needed to run Julia scripts, but it is not found on your " - "PATH." + "PATH.", ) assert len(marks) == 1 diff --git a/tests/conftest.py b/tests/conftest.py index b9cc8b8..8e753cc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,7 @@ needs_julia = pytest.mark.skipif( - shutil.which("julia") is None, reason="julia needs to be installed." + shutil.which("julia") is None, reason="julia needs to be installed.", ) diff --git a/tests/test_collect.py b/tests/test_collect.py index 2388b76..4bc3a55 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -82,7 +82,7 @@ def test_parse_julia_mark( ): with expectation: out = _parse_julia_mark( - mark, default_options, default_serializer, default_suffix, default_project + mark, default_options, default_serializer, default_suffix, default_project, ) assert out == expected diff --git a/tests/test_execute.py b/tests/test_execute.py index 589db09..ae4cb74 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -23,10 +23,10 @@ def test_pytask_execute_task_setup_missing_julia(monkeypatch): """Make sure that the task setup raises errors.""" # Act like julia is installed since we do not test this. monkeypatch.setattr( - "pytask_julia.execute.shutil.which", lambda x: None # noqa: ARG005 + "pytask_julia.execute.shutil.which", lambda x: None, # noqa: ARG005 ) task = Task( - base_name="example", path=Path(), function=None, markers=[Mark("julia", (), {})] + base_name="example", path=Path(), function=None, markers=[Mark("julia", (), {})], ) with pytest.raises(RuntimeError, match="julia is needed"): pytask_execute_task_setup(task) @@ -37,7 +37,7 @@ def test_pytask_execute_task_setup_missing_julia(monkeypatch): @parametrize_parse_code_serializer_suffix @pytest.mark.parametrize("depends_on", ["'in_1.txt'", "['in_1.txt', 'in_2.txt']"]) def test_run_jl_script( - runner, tmp_path, parse_config_code, serializer, suffix, depends_on + runner, tmp_path, parse_config_code, serializer, suffix, depends_on, ): task_source = f""" import pytask @@ -75,7 +75,7 @@ def task_run_jl_script(): assert result.exit_code == ExitCode.OK assert tmp_path.joinpath("out.txt").exists() assert tmp_path.joinpath( - ".pytask", "task_dummy_py_task_run_jl_script" + suffix + ".pytask", "task_dummy_py_task_run_jl_script" + suffix, ).exists() @@ -83,7 +83,7 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_run_jl_script_w_task_decorator( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): task_source = f""" import pytask @@ -118,7 +118,7 @@ def run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_raise_error_if_julia_is_not_found( - tmp_path, monkeypatch, parse_config_code, serializer, suffix + tmp_path, monkeypatch, parse_config_code, serializer, suffix, ): task_source = f""" import pytask @@ -146,7 +146,7 @@ def task_run_jl_script(): # Hide julia if available. monkeypatch.setattr( - "pytask_julia.execute.shutil.which", lambda x: None # noqa: ARG005 + "pytask_julia.execute.shutil.which", lambda x: None, # noqa: ARG005 ) session = main({"paths": tmp_path}) @@ -159,7 +159,7 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_run_jl_script_w_wrong_cmd_option( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): task_source = f""" import pytask @@ -195,7 +195,7 @@ def task_run_jl_script(): @pytest.mark.parametrize("n_threads", [2, 3]) @parametrize_parse_code_serializer_suffix def test_check_passing_cmd_line_options( - runner, tmp_path, n_threads, parse_config_code, serializer, suffix + runner, tmp_path, n_threads, parse_config_code, serializer, suffix, ): task_source = f""" import pytask @@ -242,7 +242,7 @@ def task_run_jl_script(): ) @pytest.mark.parametrize("path", [ROOT, "relative_from_config"]) def test_run_jl_script_w_environment_in_config( - runner, tmp_path, parse_config_code, serializer, suffix, config_path, value, path + runner, tmp_path, parse_config_code, serializer, suffix, config_path, value, path, ): task_source = f""" import pytask @@ -279,7 +279,7 @@ def task_run_jl_script(): assert result.exit_code == ExitCode.OK assert tmp_path.joinpath("out.txt").exists() assert tmp_path.joinpath( - ".pytask", "task_dummy_py_task_run_jl_script" + suffix + ".pytask", "task_dummy_py_task_run_jl_script" + suffix, ).exists() @@ -291,7 +291,7 @@ def task_run_jl_script(): ) @parametrize_parse_code_serializer_suffix def test_run_jl_script_w_environment_relative_to_task( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): project_in_task = Path(os.path.relpath(ROOT, tmp_path)).as_posix() @@ -324,7 +324,7 @@ def task_run_jl_script(): assert result.exit_code == ExitCode.OK assert tmp_path.joinpath("out.txt").exists() assert tmp_path.joinpath( - ".pytask", "task_dummy_py_task_run_jl_script" + suffix + ".pytask", "task_dummy_py_task_run_jl_script" + suffix, ).exists() diff --git a/tests/test_normal_execution_w_plugin.py b/tests/test_normal_execution_w_plugin.py index 78d67cc..edb21ab 100644 --- a/tests/test_normal_execution_w_plugin.py +++ b/tests/test_normal_execution_w_plugin.py @@ -15,7 +15,7 @@ ) @pytest.mark.parametrize("products", [("out.txt",), ("out_1.txt", "out_2.txt")]) def test_execution_w_varying_dependencies_products( - runner, tmp_path, dependencies, products + runner, tmp_path, dependencies, products, ): source = f""" import pytask diff --git a/tests/test_parallel.py b/tests/test_parallel.py index ccdf5e3..266f2a9 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -20,7 +20,7 @@ pytestmark = pytest.mark.skipif( - not _IS_PYTASK_PARALLEL_INSTALLED, reason="Tests require pytask-parallel." + not _IS_PYTASK_PARALLEL_INSTALLED, reason="Tests require pytask-parallel.", ) @@ -36,7 +36,7 @@ @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_files_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): """Test parallelization over source files. @@ -107,7 +107,7 @@ def task_execute_julia(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_files_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): """Test parallelization over source files. @@ -166,7 +166,7 @@ def task_execute_julia(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_file_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): """Test parallelization over the same source file. @@ -215,7 +215,7 @@ def task_execute_julia_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_file_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): """Test parallelization over the same source file. diff --git a/tests/test_parametrize.py b/tests/test_parametrize.py index 3260e1b..cbba892 100644 --- a/tests/test_parametrize.py +++ b/tests/test_parametrize.py @@ -22,7 +22,7 @@ @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrized_execution_of_jl_script_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): task_source = f""" import pytask @@ -69,7 +69,7 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrized_execution_of_jl_script_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): task_source = f""" import pytask @@ -107,7 +107,7 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrize_jl_options_and_product_paths_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): task_source = f""" import pytask @@ -154,7 +154,7 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrize_jl_options_and_product_paths_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix + runner, tmp_path, parse_config_code, serializer, suffix, ): task_source = f""" import pytask From 0d48cb19547952d2be7c130ecdb81a158f166a6d Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sat, 21 Jan 2023 14:02:45 +0100 Subject: [PATCH 3/3] Fix. --- pyproject.toml | 3 +- src/pytask_julia/collect.py | 21 +++++--- src/pytask_julia/execute.py | 10 ++-- src/pytask_julia/parametrize.py | 2 +- src/pytask_julia/shared.py | 3 ++ tests/conftest.py | 3 +- tests/test_collect.py | 6 ++- tests/test_execute.py | 67 ++++++++++++++++++++----- tests/test_normal_execution_w_plugin.py | 5 +- tests/test_parallel.py | 27 ++++++++-- tests/test_parametrize.py | 24 +++++++-- 11 files changed, 135 insertions(+), 36 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1e5a558..ccd88dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,11 +51,12 @@ extend-ignore = [ "EM", # flake8-errmsg "ANN401", # flake8-annotate typing.Any "PD", # pandas-vet + "COM812", # trailing comma missing, but black takes care of that ] [tool.ruff.per-file-ignores] -"tests/*" = ["D", "ANN"] +"tests/*" = ["D", "ANN", "PLR2004"] [tool.ruff.pydocstyle] diff --git a/src/pytask_julia/collect.py b/src/pytask_julia/collect.py index edb2a1e..a34b924 100644 --- a/src/pytask_julia/collect.py +++ b/src/pytask_julia/collect.py @@ -19,6 +19,7 @@ from pytask import Task from pytask_julia.serialization import SERIALIZERS from pytask_julia.shared import julia +from pytask_julia.shared import JULIA_SCRIPT_KEY from pytask_julia.shared import parse_relative_path @@ -27,7 +28,10 @@ def run_jl_script( - script: Path, options: list[str], serialized: Path, project: list[str], + script: Path, + options: list[str], + serialized: Path, + project: list[str], ) -> None: """Run a Julia script.""" cmd = ["julia"] + options + project + [_SEPARATOR, str(script), str(serialized)] @@ -37,7 +41,10 @@ def run_jl_script( @hookimpl def pytask_collect_task( - session: Session, path: Path, name: str, obj: Any, + session: Session, + path: Path, + name: str, + obj: Any, ) -> Task | None: """Collect a task which is a function. @@ -90,21 +97,23 @@ def pytask_collect_task( ) script_node = session.hook.pytask_collect_node( - session=session, path=path, node=script, + session=session, + path=path, + node=script, ) if isinstance(task.depends_on, dict): - task.depends_on["__script"] = script_node + task.depends_on[JULIA_SCRIPT_KEY] = script_node task.attributes["julia_keep_dict"] = True else: - task.depends_on = {0: task.depends_on, "__script": script_node} + task.depends_on = {0: task.depends_on, JULIA_SCRIPT_KEY: script_node} task.attributes["julia_keep_dict"] = False parsed_project = _parse_project(project, task.path.parent) task.function = functools.partial( task.function, - script=task.depends_on["__script"].path, + script=task.depends_on[JULIA_SCRIPT_KEY].path, options=options, project=parsed_project, ) diff --git a/src/pytask_julia/execute.py b/src/pytask_julia/execute.py index d5e1064..66b4c66 100644 --- a/src/pytask_julia/execute.py +++ b/src/pytask_julia/execute.py @@ -12,6 +12,7 @@ from pytask_julia.serialization import create_path_to_serialized from pytask_julia.serialization import serialize_keyword_arguments from pytask_julia.shared import julia +from pytask_julia.shared import JULIA_SCRIPT_KEY @hookimpl @@ -45,13 +46,16 @@ def collect_keyword_arguments(task: Task) -> dict[str, Any]: kwargs = dict(task.kwargs) task.kwargs = {} - if len(task.depends_on) == 1 and "__script" in task.depends_on: + if len(task.depends_on) == 1 and JULIA_SCRIPT_KEY in task.depends_on: pass - elif not task.attributes["julia_keep_dict"] and len(task.depends_on) == 2: + elif ( + not task.attributes["julia_keep_dict"] + and len(task.depends_on) == 2 # noqa: PLR2004 + ): kwargs["depends_on"] = str(task.depends_on[0].value) else: kwargs["depends_on"] = tree_map(lambda x: str(x.value), task.depends_on) - kwargs["depends_on"].pop("__script") + kwargs["depends_on"].pop(JULIA_SCRIPT_KEY) if task.produces: kwargs["produces"] = tree_map(lambda x: str(x.value), task.produces) diff --git a/src/pytask_julia/parametrize.py b/src/pytask_julia/parametrize.py index 06193c7..6b15883 100644 --- a/src/pytask_julia/parametrize.py +++ b/src/pytask_julia/parametrize.py @@ -10,5 +10,5 @@ @hookimpl def pytask_parametrize_kwarg_to_marker(obj: Any, kwargs: dict[str, Any]) -> None: """Attach parametrized Julia arguments to the function with a marker.""" - if callable(obj) and "julia" in kwargs: + if callable(obj) and "julia" in kwargs: # noqa: PLR2004 pytask.mark.julia(**kwargs.pop("julia"))(obj) diff --git a/src/pytask_julia/shared.py b/src/pytask_julia/shared.py index f6d8223..d9f2672 100644 --- a/src/pytask_julia/shared.py +++ b/src/pytask_julia/shared.py @@ -8,6 +8,9 @@ from typing import Sequence +JULIA_SCRIPT_KEY = "__script" + + def julia( script: str | Path, options: str | Iterable[str] | None = None, diff --git a/tests/conftest.py b/tests/conftest.py index 8e753cc..24334eb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,8 @@ needs_julia = pytest.mark.skipif( - shutil.which("julia") is None, reason="julia needs to be installed.", + shutil.which("julia") is None, + reason="julia needs to be installed.", ) diff --git a/tests/test_collect.py b/tests/test_collect.py index 4bc3a55..c0ecedc 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -82,7 +82,11 @@ def test_parse_julia_mark( ): with expectation: out = _parse_julia_mark( - mark, default_options, default_serializer, default_suffix, default_project, + mark, + default_options, + default_serializer, + default_suffix, + default_project, ) assert out == expected diff --git a/tests/test_execute.py b/tests/test_execute.py index ae4cb74..2bc68cf 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -23,10 +23,14 @@ def test_pytask_execute_task_setup_missing_julia(monkeypatch): """Make sure that the task setup raises errors.""" # Act like julia is installed since we do not test this. monkeypatch.setattr( - "pytask_julia.execute.shutil.which", lambda x: None, # noqa: ARG005 + "pytask_julia.execute.shutil.which", + lambda x: None, # noqa: ARG005 ) task = Task( - base_name="example", path=Path(), function=None, markers=[Mark("julia", (), {})], + base_name="example", + path=Path(), + function=None, + markers=[Mark("julia", (), {})], ) with pytest.raises(RuntimeError, match="julia is needed"): pytask_execute_task_setup(task) @@ -37,7 +41,12 @@ def test_pytask_execute_task_setup_missing_julia(monkeypatch): @parametrize_parse_code_serializer_suffix @pytest.mark.parametrize("depends_on", ["'in_1.txt'", "['in_1.txt', 'in_2.txt']"]) def test_run_jl_script( - runner, tmp_path, parse_config_code, serializer, suffix, depends_on, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, + depends_on, ): task_source = f""" import pytask @@ -75,7 +84,8 @@ def task_run_jl_script(): assert result.exit_code == ExitCode.OK assert tmp_path.joinpath("out.txt").exists() assert tmp_path.joinpath( - ".pytask", "task_dummy_py_task_run_jl_script" + suffix, + ".pytask", + "task_dummy_py_task_run_jl_script" + suffix, ).exists() @@ -83,7 +93,11 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_run_jl_script_w_task_decorator( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask @@ -118,7 +132,11 @@ def run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_raise_error_if_julia_is_not_found( - tmp_path, monkeypatch, parse_config_code, serializer, suffix, + tmp_path, + monkeypatch, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask @@ -146,7 +164,8 @@ def task_run_jl_script(): # Hide julia if available. monkeypatch.setattr( - "pytask_julia.execute.shutil.which", lambda x: None, # noqa: ARG005 + "pytask_julia.execute.shutil.which", + lambda x: None, # noqa: ARG005 ) session = main({"paths": tmp_path}) @@ -159,7 +178,11 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_run_jl_script_w_wrong_cmd_option( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask @@ -195,7 +218,12 @@ def task_run_jl_script(): @pytest.mark.parametrize("n_threads", [2, 3]) @parametrize_parse_code_serializer_suffix def test_check_passing_cmd_line_options( - runner, tmp_path, n_threads, parse_config_code, serializer, suffix, + runner, + tmp_path, + n_threads, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask @@ -242,7 +270,14 @@ def task_run_jl_script(): ) @pytest.mark.parametrize("path", [ROOT, "relative_from_config"]) def test_run_jl_script_w_environment_in_config( - runner, tmp_path, parse_config_code, serializer, suffix, config_path, value, path, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, + config_path, + value, + path, ): task_source = f""" import pytask @@ -279,7 +314,8 @@ def task_run_jl_script(): assert result.exit_code == ExitCode.OK assert tmp_path.joinpath("out.txt").exists() assert tmp_path.joinpath( - ".pytask", "task_dummy_py_task_run_jl_script" + suffix, + ".pytask", + "task_dummy_py_task_run_jl_script" + suffix, ).exists() @@ -291,7 +327,11 @@ def task_run_jl_script(): ) @parametrize_parse_code_serializer_suffix def test_run_jl_script_w_environment_relative_to_task( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): project_in_task = Path(os.path.relpath(ROOT, tmp_path)).as_posix() @@ -324,7 +364,8 @@ def task_run_jl_script(): assert result.exit_code == ExitCode.OK assert tmp_path.joinpath("out.txt").exists() assert tmp_path.joinpath( - ".pytask", "task_dummy_py_task_run_jl_script" + suffix, + ".pytask", + "task_dummy_py_task_run_jl_script" + suffix, ).exists() diff --git a/tests/test_normal_execution_w_plugin.py b/tests/test_normal_execution_w_plugin.py index edb21ab..6ed0f0c 100644 --- a/tests/test_normal_execution_w_plugin.py +++ b/tests/test_normal_execution_w_plugin.py @@ -15,7 +15,10 @@ ) @pytest.mark.parametrize("products", [("out.txt",), ("out_1.txt", "out_2.txt")]) def test_execution_w_varying_dependencies_products( - runner, tmp_path, dependencies, products, + runner, + tmp_path, + dependencies, + products, ): source = f""" import pytask diff --git a/tests/test_parallel.py b/tests/test_parallel.py index 266f2a9..ef8fd09 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -20,7 +20,8 @@ pytestmark = pytest.mark.skipif( - not _IS_PYTASK_PARALLEL_INSTALLED, reason="Tests require pytask-parallel.", + not _IS_PYTASK_PARALLEL_INSTALLED, + reason="Tests require pytask-parallel.", ) @@ -36,7 +37,11 @@ @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_files_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): """Test parallelization over source files. @@ -107,7 +112,11 @@ def task_execute_julia(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_files_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): """Test parallelization over source files. @@ -166,7 +175,11 @@ def task_execute_julia(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_file_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): """Test parallelization over the same source file. @@ -215,7 +228,11 @@ def task_execute_julia_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parallel_parametrization_over_source_file_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): """Test parallelization over the same source file. diff --git a/tests/test_parametrize.py b/tests/test_parametrize.py index cbba892..334050e 100644 --- a/tests/test_parametrize.py +++ b/tests/test_parametrize.py @@ -22,7 +22,11 @@ @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrized_execution_of_jl_script_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask @@ -69,7 +73,11 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrized_execution_of_jl_script_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask @@ -107,7 +115,11 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrize_jl_options_and_product_paths_w_parametrize( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask @@ -154,7 +166,11 @@ def task_run_jl_script(): @pytest.mark.end_to_end() @parametrize_parse_code_serializer_suffix def test_parametrize_jl_options_and_product_paths_w_loop( - runner, tmp_path, parse_config_code, serializer, suffix, + runner, + tmp_path, + parse_config_code, + serializer, + suffix, ): task_source = f""" import pytask