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

Allow nwbinspector CLI to accept URLs #559

Merged
merged 4 commits into from
Feb 20, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

### Fixes
* Fix wrongly triggered compression check [#552](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/552)
* Fixed URL inspection using the CLI [#559](https://github.com/NeurodataWithoutBorders/nwbinspector/issues/559)

## Improvements
* Added a section for describing the issues with negative timestamps in `TimeSeries` [#545](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/545)
Expand Down
2 changes: 1 addition & 1 deletion src/nwbinspector/_nwbinspector_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def _nwbinspector_cli(
show_progress_bar=show_progress_bar,
)
# Scan a single NWB file in a Dandiset
elif stream and ":" in path:
elif stream and ":" in path and not path_is_url:
dandiset_id, dandi_file_path = path.split(":")
dandiset_version = version_id

Expand Down
14 changes: 14 additions & 0 deletions tests/streaming_cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,17 @@ def test_dandiset_streaming_cli_with_version_saved_report(tmpdir: py.path.local)
expected_report_length = 38
report_end = report_start + expected_report_length
assert test_report[report_start:report_end] == expected_report[14:]


@pytest.mark.skipif(not STREAMING_TESTS_ENABLED, reason=DISABLED_STREAMING_TESTS_REASON or "")
def test_inspect_url_cli(tmp_path):
"""Test that the CLI correctly handles inspecting a URL."""
url = "https://dandiarchive.s3.amazonaws.com/blobs/11e/c89/11ec8933-1456-4942-922b-94e5878bb991"
console_output_file = tmp_path / "url_console_output.txt"

os.system(f"nwbinspector {url} " "--skip-validate " f"> {console_output_file}")

# Read and check the contents of the console output file
with open(console_output_file, "r") as file:
output = file.read()
assert "Subject species is missing." in output
Loading