mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-08-26 17:31:37 +00:00
Pure refactor, no behavior change. Moves services/navi_geo/dem.py to shared/dem.py (verbatim logic + env override; only docstring + location changed) and re-points navi-geo's two imports (geo_route.py, admin.py) to `from shared.dem import ...`. Per extraction-8-phase-a.md §5/§13.1: navi-offroute (#18) needs the same DEMReader, so a single source of truth in shared/ beats a third copy. Second shared/ promotion after PR #7 round-2's shared/git_sha.py; navi-offroute will `from shared.dem import DEMReader` directly. Adds shared/tests/test_dem.py (dem_path default + NAVI_DEM_PMTILES override). navi-geo behavior unchanged (test_reverse_bundle mocks geo_route._DEM, agnostic to DEMReader's location). Full suite: 104 passed / 1 skipped (+2). Co-authored-by: zvx-echo6 <mj@k7zvx.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 lines
733 B
Python
18 lines
733 B
Python
"""Hermetic tests for shared.dem — no live PMTiles I/O (the real file is 657 GB).
|
|
|
|
Behavioural coverage of DEMReader.sample_point already lives in navi-geo's
|
|
test_reverse_bundle.py (via the geo_route._DEM mock); these only pin the shared
|
|
module's import + the env-override path contract.
|
|
"""
|
|
from shared.dem import DEMReader, dem_path, DEFAULT_DEM_PATH # noqa: F401 (import smoke)
|
|
|
|
|
|
def test_dem_path_default_when_unset(monkeypatch):
|
|
monkeypatch.delenv('NAVI_DEM_PMTILES', raising=False)
|
|
assert dem_path() == DEFAULT_DEM_PATH
|
|
|
|
|
|
def test_dem_path_env_override(monkeypatch, tmp_path):
|
|
custom = tmp_path / 'custom.pmtiles'
|
|
monkeypatch.setenv('NAVI_DEM_PMTILES', str(custom))
|
|
assert str(dem_path()) == str(custom)
|