Skip to content

test: add network and orchestration unit tests for stations, download… - #12

Merged
jsteinberg34 merged 1 commit into
mainfrom
phase-4-testing
Jun 25, 2026
Merged

test: add network and orchestration unit tests for stations, download…#12
jsteinberg34 merged 1 commit into
mainfrom
phase-4-testing

Conversation

@jsteinberg34

Copy link
Copy Markdown
Owner

Summary

Phase 4 of the test suite: the acquisition + orchestration layer. Phases 1–3 cover the deterministic/network-free code; this adds coverage for stations.py, download.py, the Space-Track network branch of track.py, and run_pipeline. The genuinely network-bound seams (FDSN Client/MassDownloader, Space-Track) are replaced with fakes, so everything runs deterministically with no network.

What's new

  • tests/test_stations.py — all of stations.py (network-free): StationXML discovery, parsing (incl. skip-on-corrupt-file), dedup, corridor distance filter with min_dist_km, longitude wrapping, and the load_and_filter_stations end-to-end chain.
  • tests/test_download.py — pure helpers (_normalize_providers, _count_files, the _make_mseed_storage approval gate) plus download_boxes driven with faked Client/MassDownloader: happy path (candidate → dedup → corridor filter → download → manifest), skip-existing, apply_processing hand-off, all-stations-rejected, and resilience (provider-init / get_stations no-data + generic / downloader errors all tolerated).
  • tests/test_track.py — adds the Space-Track network branch via a faked client: fetch_tle_best_before_cached cache-miss (query + cache write) and build_track_from_norad end-to-end (faked TLE → real offline propagation).
  • tests/test_pipeline.pyrun_pipeline with both heavy stages spied: verifies ISO-string→UTC parsing, that the real tiling stage runs and feeds the download requests, and the {track, boxes, manifest} return shape.
  • tests/conftest.py — adds FakeFDSNClient, FakeMassDownloader (drives the real storage callback and writes files), and FakeSpaceTrack; makes the synthetic-inventory builder reusable with lat/lon. Additive only.

Coverage

Module Coverage
stations.py 100%
track.py 88%
download.py 85%
pipeline.py 85%

Remaining misses in these modules are verbose=True logging lines — every logic branch is covered. plotting.py is the only module still untested (Phase 5).

Testing

pytest          # 112 passed, fully offline

@jsteinberg34 jsteinberg34 self-assigned this Jun 25, 2026
@jsteinberg34 jsteinberg34 added the enhancement New feature or request label Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jsteinberg34
jsteinberg34 merged commit 12fd27e into main Jun 25, 2026
5 checks passed
@jsteinberg34
jsteinberg34 deleted the phase-4-testing branch June 25, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant