From 5bbc1e6af697afc45561dfd156e6a21bf66d641c Mon Sep 17 00:00:00 2001 From: Jon Clucas Date: Fri, 23 Aug 2024 13:47:06 -0400 Subject: [PATCH] :white_check_mark: Use tmp_path for pipeline tests --- CPAC/pipeline/test/test_cpac_pipeline.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CPAC/pipeline/test/test_cpac_pipeline.py b/CPAC/pipeline/test/test_cpac_pipeline.py index 1eef42faf..4f3b4b254 100644 --- a/CPAC/pipeline/test/test_cpac_pipeline.py +++ b/CPAC/pipeline/test/test_cpac_pipeline.py @@ -1,9 +1,11 @@ """Tests for cpac_pipeline.py.""" -from typing import cast +from pathlib import Path +from typing import cast, Optional import pandas as pd import pytest +from nipype.pipeline.plugins.base import PluginBase as Plugin from CPAC.pipeline.cpac_pipeline import run_workflow from CPAC.pipeline.nipype_pipeline_engine.plugins import MultiProcPlugin @@ -12,12 +14,20 @@ @pytest.mark.parametrize("plugin", [MultiProcPlugin(), False, "MultiProc", None]) -def test_plugin_param(plugin): +def test_plugin_param(plugin: Optional[Plugin | bool | str], tmp_path: Path): """We should get an KeyError from our empty `sub_dict`. If we pass a non-string to run_workflow, a TypeError should be raised. """ - cfg = Configuration() + cfg = Configuration( + { + "pipeline_setup": { + "output_directory": {"path": str(tmp_path / "out")}, + "working_directory": {"path": str(tmp_path / "work")}, + "log_directory": {"path": str(tmp_path / "log")}, + } + } + ) with pytest.raises((TypeError, KeyError)) as e: sub_group = cast(SUB_GROUP, ((("", ""), pd.DataFrame([]))))