8000 Bug fixes by tclose · Pull Request #15 · nipype/nipype2pydra · GitHub
[go: up one dir, main page]

Skip to content

Bug fixes #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
added missing imports to autogenerated conftest
  • Loading branch information
tclose committed Mar 17, 2024
commit 25a4a2632594c8656cf67524858ea6c5fb145ba5
17 changes: 14 additions & 3 deletions nipype2pydra/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class InputsConverter(SpecConverter):
metadata: dict[str, dict[str, Any]], optional
additional metadata to set on any of the input fields (e.g. out_file: position: 1)
"""

callable_defaults: ty.Dict[str, str] = attrs.field(
factory=dict,
converter=default_if_none(factory=dict), # type: ignore
Expand Down Expand Up @@ -403,7 +404,8 @@ class BaseTaskConverter(metaclass=ABCMeta):
converter=from_dict_to_outputs,
)
callables_module: ModuleType = attrs.field(
converter=import_module_from_path, default=None,
converter=import_module_from_path,
default=None,
)
tests: ty.List[TestGenerator] = attrs.field( # type: ignore
factory=list, converter=from_list_to_tests
Expand Down Expand Up @@ -838,7 +840,9 @@ def write_tests(self, filename_test, input_fields, nonstd_types, run=False):
else:
assert len(field) == 3
# Attempt to pick a sensible value for field
trait = self.nipype_interface.input_spec.class_traits()[nm]
trait = self.nipype_interface.input_spec.class_traits()[
nm
]
if isinstance(trait, traits.trait_types.Enum):
value = trait.values[0]
elif isinstance(trait, traits.trait_types.Range):
Expand Down Expand Up @@ -868,7 +872,10 @@ def write_tests(self, filename_test, input_fields, nonstd_types, run=False):
imports = self.construct_imports(
nonstd_types,
spec_str,
base={"import pytest", "from nipype2pydra.testing import PassAfterTimeoutWorker"},
base={
"import pytest",
"from nipype2pydra.testing import PassAfterTimeoutWorker",
},
)
spec_str = "\n".join(imports) + "\n\n" + spec_str

Expand Down Expand Up @@ -946,6 +953,10 @@ def create_doctests(self, input_fields, nonstd_types):
CONFTEST = """
# For debugging in IDE's don't catch raised exceptions and let the IDE
# break at it
import os
import pytest


if os.getenv("_PYTEST_RAISE", "0") != "0":

@pytest.hookimpl(tryfirst=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from fileformats.generic import File


class Oned(File):
class OneD(File):
ext = ".1D"
alternate_exts = (".1d",)
binary = True


class Threed(File):
class ThreeD(File):
ext = ".3D"
binary = True

Expand Down
0