Skip to content

Commit

Permalink
✅ Use tmp_path for pipeline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy committed Aug 23, 2024
1 parent 43a9b27 commit 5bbc1e6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions CPAC/pipeline/test/test_cpac_pipeline.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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([]))))
Expand Down

0 comments on commit 5bbc1e6

Please sign in to comment.