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

skip mac sidecars #470

Merged
merged 11 commits into from
May 30, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Fixed the suggested rate in `check_regular_timestamps` to be in Hz [#467](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/467)

* Added a skip for mac sidecar files (._*): [#470](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/470)

# v0.4.35

### Fixes
Expand Down
3 changes: 3 additions & 0 deletions src/nwbinspector/nwbinspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ def inspect_all(
in_path = Path(path)
if in_path.is_dir():
nwbfiles = list(in_path.rglob("*.nwb"))

# Remove any macOS sidecar files
nwbfiles = [nwbfile for nwbfile in nwbfiles if not nwbfile.name.startswith("._")]
elif in_path.is_file():
nwbfiles = [in_path]
else:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def setUpClass(cls):
# Last file to be left without violations

cls.nwbfile_paths = [str(cls.tempdir / f"testing{j}.nwb") for j in range(num_nwbfiles)]
nwbfiles.append(make_minimal_nwbfile())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minimal NWB file would have no problems with it though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe bump the number of files to 4, do one of the common violations to the last one, and add ._ to the autogenerated nwbfile_path of the last one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closer - it will have to be an additional one tacked onto the end though, not index 2 (since that already exists and has specific tests for it)

Either that or a simpler standalone unit test for just this particular behavior

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok now the sidecar test file is the last one in the list and the no-error file is back to being the third

cls.nwbfile_paths.append(str(cls.tempdir / "._testing0.nwb"))
for nwbfile_path, nwbfile in zip(cls.nwbfile_paths, nwbfiles):
with NWBHDF5IO(path=nwbfile_path, mode="w") as io:
io.write(nwbfile)
Expand Down
Loading