Repository navigation
Testing and Contributing
Salvador Navas edited this page Aug 4, 2026
·
2 revisions
pip install pytest
pytest tests/The current test suite focuses on deterministic unit tests and mocked external services where possible. Some notebooks and integration workflows require network access, credentials, large data or external model software and are not appropriate as ordinary unit tests.
The test suite covers:
- AEMET parsing and helpers;
- bias correction;
- pilot-case data downloader behavior with mocked requests;
- ESGF helpers;
- event extraction;
- extreme-value fitting utilities;
- HEC-HMS runtime helper behavior;
- hybrid interpolation;
- SWAT/HEC-RAS file-adapter helpers;
- OGIMET processing;
- stochastic precipitation model helpers;
- regional frequency analysis;
- river-discharge readers/download helpers;
- SoilGrids utilities;
- time-series statistics;
- uncertainty-propagation strategy selection (
pyhydra.uq): design nestedness, budget accounting, diagnostic/estimator identity and the emulability threshold.
Prefer tests that:
- are deterministic;
- avoid real network calls;
- use
tmp_pathfor file IO; - use
monkeypatchfor credentials, requests and subprocesses; - check scientific contracts, not just that functions run;
- document model-adapter limits clearly.
Avoid committing tests that require proprietary software or local absolute paths unless they are explicitly marked as integration tests and skipped by default.
git checkout -b feature/my-change
pip install -e .
pytest tests/
git status
git commit -m "Describe the change"
git pushBefore opening a pull request or merging:
- update README/wiki/notebooks if the public behavior changes;
- add or update tests for new public functions;
- avoid committing generated data, model outputs or secrets;
- check that package imports still work from a clean environment.
- Distinguish
pyhydrafrom HYDRA. - Distinguish model families from libraries: NEOPRENE contains NSRP/STNSRP workflows; CoSMoS_py supports CoSMoS workflows.
- Do not describe an adapter as a complete prepare-run-read interface unless all three operations are implemented for that model.
- State external dependencies and credentials explicitly.