commit 4d124c4c4952d27cfd619beb899fee492dd5b1ac from: ale date: Wed Aug 19 03:46:58 2026 UTC Load ASTROMETRY_API_KEY from a gitignored .env for local test runs The live plate_solve round-trip test was always skipped in practice — nothing set ASTROMETRY_API_KEY without manually exporting it by hand each session. test/runtests.jl now reads a repo-root .env (gitignored; .env.example documents the expected format) before the test suite runs, without overriding a real environment variable if one's already set. Not read by src/ itself — plate_solve takes api_key as an explicit argument, this is test-only convenience. Verified end to end: a real (intentionally invalid) key in .env made the test stop skipping and actually hit the live service, which correctly rejected it — confirms the loader, not just its parsing logic in isolation. commit - 6610d9676c5a5741699d5a25bc18abddb02970f3 commit + 4d124c4c4952d27cfd619beb899fee492dd5b1ac blob - /dev/null blob + 1d0f8ba7d8154d76cfa9c4122819c596a10a35ba (mode 644) --- /dev/null +++ .env.example @@ -0,0 +1,7 @@ +# Copy this file to .env (gitignored) and fill in real values. +# test/runtests.jl loads .env automatically before running the tests. + +# nova.astrometry.net API key — get it from "My Profile" after signing in +# at https://nova.astrometry.net/. Enables the live plate_solve round-trip +# test; without it, that one test is skipped instead of run. +ASTROMETRY_API_KEY= blob - a8a1df41d600e2b0f78567ecf6988a7247cdcac1 blob + d73fe911444d7c51ce225eeab80be17d8604ff8d --- .gitignore +++ .gitignore @@ -31,3 +31,7 @@ docs/src/assets/iasc-match-radius-retuning.png # part of the project (the wiki documents the pipeline, not its own # deploy infrastructure). PAGES_NOTES.md + +# Real API keys for local test runs (e.g. ASTROMETRY_API_KEY) — see +# .env.example for the expected format. +.env blob - 51b08bc638beb16b9e8077145d544825e71d11ca blob + 363321dbd6f1e254aaa3b0b336321b55b3025150 --- test/runtests.jl +++ test/runtests.jl @@ -9,6 +9,25 @@ using Statistics using Reproject using Distributed +# Loads .env (repo root, gitignored) into ENV for local test runs — e.g. +# ASTROMETRY_API_KEY, which enables the live plate_solve round-trip test +# below instead of skipping it. Real environment variables always win: a +# line here is only applied if that key isn't already set. Not read by +# src/ itself — plate_solve takes api_key as an explicit argument; this +# is test-only convenience. +let env_file = joinpath(pkgdir(AsteroidPipeline), ".env") + if isfile(env_file) + for line in eachline(env_file) + line = strip(line) + (isempty(line) || startswith(line, "#")) && continue + k, v = split(line, "="; limit=2) + k = strip(k) + v = strip(strip(v), ['"', '\'']) + haskey(ENV, k) || (ENV[k] = v) + end + end +end + @testset "AsteroidPipeline.jl" begin @testset "detect_sources" begin