All checks were successful
Smoke Test / smoke (pull_request) Successful in 14s
- scripts/weekly_update.py: Auto-generates weekly update from git log, Gitea API (issues/PRs/blockers), and benchmark results. Supports --post to issue #76, --json for raw data, --since for date range. - scripts/weekly_update.sh: Shell wrapper for convenience. - docs/WEEKLY_TEMPLATE.md: Manual update template. - docs/PROJECT_STATUS.md: Added Weekly Progress Updates section with process (weekly cadence, benchmark-as-happens, blocker escalation). - tests/test_weekly_update.py: Validates script runs, JSON output, and handles edge cases.
53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Quick test for weekly_update.py — verifies parsing, output format, and edge cases."""
|
|
|
|
import subprocess
|
|
import sys
|
|
import json
|
|
from pathlib import Path
|
|
|
|
SCRIPT = Path(__file__).resolve().parent.parent / "scripts" / "weekly_update.py"
|
|
|
|
def run(args: list[str]) -> str:
|
|
result = subprocess.run(
|
|
[sys.executable, str(SCRIPT)] + args,
|
|
capture_output=True, text=True, cwd=str(SCRIPT.parent.parent)
|
|
)
|
|
return result.stdout, result.stderr, result.returncode
|
|
|
|
def test_basic_output():
|
|
"""Script runs without error and produces markdown."""
|
|
stdout, stderr, rc = run(["--since", "2026-01-01"])
|
|
assert rc == 0, f"Exit code {rc}: {stderr}"
|
|
assert "## Week of" in stdout, f"Missing header: {stdout[:200]}"
|
|
assert "### Completed" in stdout, f"Missing Completed section: {stdout[:200]}"
|
|
assert "### Next Week" in stdout, f"Missing Next Week section: {stdout[-200:]}"
|
|
print("PASS: basic_output")
|
|
|
|
def test_json_output():
|
|
"""Script outputs valid JSON in --json mode."""
|
|
stdout, stderr, rc = run(["--json", "--since", "2026-01-01"])
|
|
assert rc == 0, f"Exit code {rc}: {stderr}"
|
|
data = json.loads(stdout)
|
|
assert "commits" in data
|
|
assert "since" in data
|
|
print(f"PASS: json_output ({len(data['commits'])} commits)")
|
|
|
|
def test_no_crash_future_date():
|
|
"""Script handles future date gracefully."""
|
|
stdout, stderr, rc = run(["--since", "2030-01-01"])
|
|
assert rc == 0, f"Exit code {rc}: {stderr}"
|
|
print("PASS: future_date_no_crash")
|
|
|
|
def test_empty_range():
|
|
"""Script handles a very old date with no commits."""
|
|
stdout, stderr, rc = run(["--since", "2020-01-01", "--since", "2020-01-02"])
|
|
assert rc == 0
|
|
print("PASS: empty_range")
|
|
|
|
if __name__ == "__main__":
|
|
test_basic_output()
|
|
test_json_output()
|
|
test_no_crash_future_date()
|
|
print("\nAll tests passed.")
|