Make the monthly season check offline: it compares each estimate's recorded track and location with the trail's current one and downloads nothing; fix the audit so every command runs as written (packets needs --out, the places tool runs in its venv), with places and seasons steps under their own headings

This commit is contained in:
swaits committed 2026-11-20 14:45:42 -07:00
1 parent e6c2f371fc
commit f91c7dbc20
9 files changed
+328 -194

No files matched your search

+27 -2
View File
@@ -35,7 +35,8 @@ class AuditChecklistTest(unittest.TestCase):
self.assertIn("estimate_season.py estimates", seasons)
self.assertIn("docs/season-research.md", seasons)
self.assertIn("search afresh for a page that states the season", seasons.lower().replace("\n", " "))
self.assertIn("re-run the machine estimate", seasons.lower())
self.assertIn("downloads nothing", seasons)
self.assertIn("fixed published dataset", seasons)
self.assertIn("1. ", seasons)
self.assertIn("2. ", seasons)
@@ -51,6 +52,27 @@ class AuditChecklistTest(unittest.TestCase):
self.assertEqual(stop.exception.code, 0, sub)
self.assertIn(f" {sub}", out.getvalue())
def test_every_command_in_the_audit_runs_as_written(self):
"""Each `python3 tools/<script>.py ...` the audit names must be accepted by that script's own
argument parser: the subcommand exists and the options and required arguments are given."""
import subprocess
doc = read("docs", "audit.md")
commands = re.findall(r"`((?:\.venv-places/bin/)?python3? (?:tools|web)/[^`]+)`", doc)
self.assertGreaterEqual(len(commands), 8)
for command in commands:
words = [w for w in command.split() if not w.startswith("<")][1:]
script, args = words[0], words[1:]
if script in ("web/build.py", "tools/validate.py", "tools/place_trails.py"):
continue # no argument parser to ask, or one that needs its own venv
# a placeholder trail id is replaced by a real one
args = ["finger-lakes" if a == "<id>" else a for a in args]
run = subprocess.run([sys.executable, os.path.join(ROOT, script), *args, "--help"],
capture_output=True, text=True, cwd=ROOT)
self.assertEqual(run.returncode, 0, (command, run.stderr[-300:]))
# the packets command has a required output directory
self.assertTrue(any(c.startswith("python3 tools/season_judge.py packets --out ") for c in commands))
self.assertFalse(any(c.endswith("season_judge.py packets") for c in commands))
def test_the_estimates_command_prints_one_id_a_line(self):
ids = E.estimates(ROOT)
self.assertEqual(len(ids), 72)
@@ -72,8 +94,11 @@ class AuditChecklistTest(unittest.TestCase):
class MonthlyWorkflowTest(unittest.TestCase):
def test_the_monthly_workflow_runs_the_check_on_a_schedule(self):
text = read(".github", "workflows", "season-check.yml")
for want in ("schedule", "workflow_dispatch", "estimate_season.py check", "cron:", "longhikes-climate"):
for want in ("schedule", "workflow_dispatch", "estimate_season.py check", "cron:"):
self.assertIn(want, text)
# offline: it downloads nothing and keeps no climate cache
self.assertNotIn("longhikes-climate", text)
self.assertNotIn("actions/cache", text)
if __name__ == "__main__":