Skip to content

Write unit tests CI, and pre-commit for main functionality #28

Description

@jcsmithhere

⚠️ Preliminary plan — review before executing. The task list below was
drafted automatically to scope this issue. It must be reviewed and approved
before any of it is implemented; treat it as a starting point, not a
committed plan.

Plan: unit tests, CI, and pre-commit

The package currently has no test suite, CI, or linting, so this covers all three. A guiding constraint: most data loaders hit live network APIs (neo-bolide, JPL CNEOS, GMN, IAU MDC), so unit tests must mock the network or use small packaged CSV/pickle fixtures rather than making real requests in CI.

1. Test scaffolding

  • Add pytest (+ pytest-cov) as a test optional-dependency group in pyproject.toml.
  • Create a tests/ package with a conftest.py providing shared fixtures (e.g. a small BolideDataFrame loaded from a committed CSV fixture).
  • Add small offline data fixtures under tests/data/ (a trimmed GLM CSV, a USG sample, a GMN sample) so loaders can be tested without network access.

2. Core BolideDataFrame tests (bdf.py)

  • Construction from each offline source: csv, pickle (and mocked glm/usg/gmn/remote).
  • Subclass preservation: indexing/filtering returns a BolideDataFrame, not a bare GeoDataFrame (_constructor, __getitem__, force_bdf_class).
  • annotate() adds the expected columns (phase, moon_fullness, solarhour, sun_alt_obs/_app).
  • filter_date (start only, end only, both; tz-naive vs tz-aware input; inplace True/False).
  • get_closest_by_time, get_closest_by_loc (haversine correctness), and get_closest dispatch logic.
  • filter_boundary and filter_observation (incl. intersection vs union; GOES-16/17 selection; the obs.csv header=1 parsing).
  • filter_shower (with a fixture ShowerDataFrame to avoid IAU network calls).
  • augment cross-matching (time/score thresholds; intersection/outer/left).

3. Supporting-module tests

  • fov_utils.get_boundary: valid names return polygons, invalid raise ValueError, intersection/union/collection options, CRS conversion.
  • astro_utils: haversine against known distances, _distance_metric, solar/lunar helpers, sol_lon_to_jd/sol_lon_to_datetime.
  • sources: each loader's parsing logic with mocked HTTP responses (e.g. responses/requests-mock or monkeypatched download).
  • sdf.ShowerDataFrame.get_dates with a fixture.
  • utils helpers (reconcile_input, make_points, str_to_list).

4. CI (GitHub Actions)

  • Add .github/workflows/tests.yml running the suite on push and PR across a Python version matrix (respect requires-python >=3.7).
  • Install system libs needed by cartopy/shapely (PROJ, GEOS) in the workflow, or use a conda-based setup.
  • Upload coverage (e.g. Codecov) and add a status badge to the README.
  • Mark the suite as a required check so it must pass before merging to master.

5. Pre-commit

  • Add .pre-commit-config.yaml with a linter/formatter consistent with existing style (~100-char lines) — e.g. ruff/flake8 plus whitespace/EOF hooks.
  • Add a hook (or .gitignore enforcement) to keep editor cruft (*.swp, *~) out of commits.
  • Document pre-commit install and how to run the tests in CLAUDE.md and the docs once in place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions