Skip to content
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

Fix support for pynwb v3 which has changed API slightly #1584

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion dandi/pynwb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,9 @@
path = str(path) # Might come in as pathlib's PATH
errors: list[ValidationResult] = []
try:
if Version(pynwb.__version__) >= Version(
if Version(pynwb.__version__) >= Version("3.0.0"):
error_outputs = pynwb.validate(path=path)
elif Version(pynwb.__version__) >= Version(

Check warning on line 357 in dandi/pynwb_utils.py

View check run for this annotation

Codecov / codecov/patch

dandi/pynwb_utils.py#L357

Added line #L357 was not covered by tests
"2.2.0"
): # Use cached namespace feature
# argument get_cached_namespaces is True by default
Expand Down
2 changes: 1 addition & 1 deletion dandi/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ def _create_nwb_files(video_list: list[tuple[Path, Path]]) -> Path:
sex="M",
description="lab mouse ",
)
device = Device(f"imaging_device_{i}")
device = Device(name=f"imaging_device_{i}")
name = f"{vid_1.stem}_{i}"
nwbfile = NWBFile(
f"{name}{i}",
Expand Down
6 changes: 5 additions & 1 deletion dandi/tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ def test_validate_bogus(tmp_path):
# but that would be too rigid to test. Let's just see that we have expected errors
assert any(
e.message.startswith(
("Unable to open file", "Unable to synchronously open file")
(
"Unable to open file",
"Unable to synchronously open file",
"Could not find an IO to read the file",
)
)
for e in errors
)
Expand Down