Skip to content

Conversation

wietzesuijker
Copy link
Collaborator

Summary

Type-safe wrapper for eopf-geozarr CLI subprocess calls. Reduces boilerplate, improves testability.

Changes

  • scripts/eopf_cli.py (98 lines): EOPFGeozarrCLI class with CLIResult dataclass
  • scripts/validate_geozarr.py: 48 lines → 17 lines (65% reduction in core function)
  • tests/unit/test_validate_geozarr.py: Mock wrapper instead of subprocess

Benefits

  • Type safety via CLIResult dataclass
  • Centralized error handling and timeout management
  • Simpler test mocking (wrapper class vs subprocess)
  • Adding new CLI commands: 5-10 lines vs 40+ lines

Testing

11/11 tests passing, 100% coverage on validate_geozarr.py

Base

test/validate-geozarr-coverage (latest modification to these files before metrics work)

- Add scripts/eopf_cli.py: type-safe wrapper with CLIResult dataclass
- Refactor validate_geozarr.py to use wrapper instead of raw subprocess
- Update tests to mock wrapper instead of subprocess.run

Reduces boilerplate, improves error handling, easier to test.
All tests passing (11/11) with 100% coverage on validate_geozarr.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant