Testing
Test Scope
The test suite is intentionally split into fast, deterministic unit tests and small smoke tests that do not import native DSPS. This keeps CI useful even when the local scientific runtime or accelerator stack is unavailable.
Current coverage:
File |
Scope |
|---|---|
|
Config normalization, COSMOS SED config validation failures, configured catalog columns. |
|
LePhare COSMOS template loading, extinction, synthetic photometry, fraction policy, validation. |
|
Catalog metadata uniqueness and unit documentation for key columns. |
|
Photometry unit conversions, truth transforms, row-index parsing, observation building. |
|
Row-centered priors and scaled beta prior support. |
|
Wavelength unit conversion, effective wavelength, ASCII filter sorting/clipping. |
|
Public workflow/reporting facades and compatibility imports. |
|
Synthetic parquet schema validation, row selection, EDA artifact creation. |
Synthetic Fixture
tests/data/synthetic_catalog.parquet is a tiny deterministic parquet file
with three rows. It covers the columns needed for schema validation, row
selection, truth transforms, metallicity derivation, and EDA reporting without
using private or large CosmoHub data.
Run Tests
python -m pytest tests
The repository also sets testpaths = ["tests"] in pyproject.toml so
plain python -m pytest does not collect local cloned repositories such as a
developer checkout of native DSPS.
Full Quality Gate
Run the same checks as CI:
find euclid_dsps scripts tests -name '*.py' -exec python -m black --check {} \;
python -m ruff check euclid_dsps scripts tests
python -m pytest tests
python -m compileall euclid_dsps scripts/quickstart_one_galaxy.py
python -m sphinx -W --keep-going -b html docs/source docs/build/html
Runtime Notes
Native DSPS/JAX workflows are still heavier than unit tests, so CI focuses on fast deterministic tests. Manual smoke commands should include:
euclid-dsps --config configs/fs2_phz1_science.yaml fit --index 0 --out outputs/runs/dev_fit_one
euclid-dsps --config configs/fs2_phz1_science.yaml fit --limit 20 --batch-size 5 --sed-samples 4 --out outputs/runs/dev_fit_batch
euclid-dsps --config configs/fs2_phz1_science.yaml check --kind cosmos --limit 10 --out outputs/runs/dev_cosmos_check