Skip to content
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
2 changes: 1 addition & 1 deletion disscube/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def main(argv: list[str] | None = None) -> int:
"record": str(report.record),
}, indent=2, default=str))
return 0
except PipelineError as exc:
except (PipelineError, ImportError) as exc: # ImportError: a missing optional extra names itself
if is_json:
import json
print(json.dumps({"status": "error", "error": str(exc)}, indent=2), file=sys.stderr)
Expand Down
11 changes: 11 additions & 0 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,14 @@ def test_pipeline_export_records_the_pipeline_and_source_checksums(tmp_path):
assert tags["PIPELINE_CHECKSUM"].startswith("sha256:")
assert src.tags(1)["SOURCE_CHECKSUM"].startswith("sha256:")
assert len(src.tags(1)["CONTENT_HASH"]) >= 32


def test_cli_reports_a_missing_netcdf_backend_without_a_traceback(tmp_path, monkeypatch, capsys):
from disscube.cli import main as cli

for name in ("h5netcdf", "h5py", "netCDF4"):
monkeypatch.setitem(sys.modules, name, None)
code = cli(["run", str(QUICKSTART), "--workspace", str(tmp_path / "ws"), "-o", str(tmp_path / "q.nc")])
err = capsys.readouterr().err
assert code == 2
assert err.startswith("error:") and "disscube[netcdf]" in err and "Traceback" not in err
Loading