test: add network and orchestration unit tests for stations, download… - #12
Merged
Conversation
…, track, and pipeline
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 oftrack.py, andrun_pipeline. The genuinely network-bound seams (FDSNClient/MassDownloader, Space-Track) are replaced with fakes, so everything runs deterministically with no network.What's new
tests/test_stations.py— all ofstations.py(network-free): StationXML discovery, parsing (incl. skip-on-corrupt-file), dedup, corridor distance filter withmin_dist_km, longitude wrapping, and theload_and_filter_stationsend-to-end chain.tests/test_download.py— pure helpers (_normalize_providers,_count_files, the_make_mseed_storageapproval gate) plusdownload_boxesdriven with fakedClient/MassDownloader: happy path (candidate → dedup → corridor filter → download → manifest), skip-existing,apply_processinghand-off, all-stations-rejected, and resilience (provider-init /get_stationsno-data + generic / downloader errors all tolerated).tests/test_track.py— adds the Space-Track network branch via a faked client:fetch_tle_best_before_cachedcache-miss (query + cache write) andbuild_track_from_noradend-to-end (faked TLE → real offline propagation).tests/test_pipeline.py—run_pipelinewith 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— addsFakeFDSNClient,FakeMassDownloader(drives the real storage callback and writes files), andFakeSpaceTrack; makes the synthetic-inventory builder reusable with lat/lon. Additive only.Coverage
stations.pytrack.pydownload.pypipeline.pyRemaining misses in these modules are
verbose=Truelogging lines — every logic branch is covered.plotting.pyis the only module still untested (Phase 5).Testing
pytest # 112 passed, fully offline