test: make test_health portable for scratch clones (closes #245) #248

Merged
sysadmin merged 1 commits from feat/issue-245-test-health-portable into master 2026-07-06 11:20:21 -05:00
Owner

Description

Fix tests/test_health.py so reviewer scratch-clone validation no longer requires a repo-local venv/bin/python.

Changes

  • _health_test_python(): prefer sys.executable, then GITEA_TOOLS_TEST_PYTHON, else SkipTest
  • _run_python_script(): subprocess timeout + terminate/kill teardown
  • Tests for interpreter resolution and skip path
  • Review-pr template note: scratch-clone validation is the norm (#245)

Validation

pytest tests/test_health.py -q  # 5 passed (no venv/ in scratch clone)
pytest tests/ -q                  # 926 passed, 6 skipped
git diff --check                  # clean

Closes #245

## Description Fix `tests/test_health.py` so reviewer scratch-clone validation no longer requires a repo-local `venv/bin/python`. ## Changes - `_health_test_python()`: prefer `sys.executable`, then `GITEA_TOOLS_TEST_PYTHON`, else `SkipTest` - `_run_python_script()`: subprocess timeout + terminate/kill teardown - Tests for interpreter resolution and skip path - Review-pr template note: scratch-clone validation is the norm (#245) ## Validation ``` pytest tests/test_health.py -q # 5 passed (no venv/ in scratch clone) pytest tests/ -q # 926 passed, 6 skipped git diff --check # clean ``` Closes #245
jcwalker3 added 1 commit 2026-07-06 10:42:51 -05:00
Use sys.executable with optional GITEA_TOOLS_TEST_PYTHON override instead of
hard-coded venv/bin/python. Add subprocess timeouts/teardown and skip when no
interpreter is available. Note scratch-clone norm in review-pr template.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
sysadmin reviewed 2026-07-06 11:10:37 -05:00
sysadmin left a comment
Owner

Review summary

Reviewed PR #248 at head d422bc0978de30fff70e7eeaad5f3de48b260097.

Scope: Matches #245 — makes tests/test_health.py portable for reviewer scratch clones by preferring sys.executable over a hard-coded venv/bin/python, with GITEA_TOOLS_TEST_PYTHON override and SkipTest fallback. Adds subprocess timeout/teardown in _run_python_script(). Documents scratch-clone norm in review-pr.md template.

Findings:

  • Interpreter resolution order is correct and well-tested (sys.executable + skip path).
  • Subprocess teardown in _run_python_script() is a solid improvement over bare subprocess.run.
  • Scope is clean: 2 files, no unrelated changes.
  • Minor nit (non-blocking): missing trailing newline at EOF in tests/test_health.py; skip message still says "repo venv not available" though venv is no longer required.

Validation (reviewer worktree, pinned head):

  • pytest tests/test_health.py -q → 5 passed
  • pytest tests/ -q → full suite passed (exit 0)
  • git diff --check master...HEAD → clean

Verdict: Approve. Ready to merge into master.

## Review summary Reviewed PR #248 at head `d422bc0978de30fff70e7eeaad5f3de48b260097`. **Scope:** Matches #245 — makes `tests/test_health.py` portable for reviewer scratch clones by preferring `sys.executable` over a hard-coded `venv/bin/python`, with `GITEA_TOOLS_TEST_PYTHON` override and `SkipTest` fallback. Adds subprocess timeout/teardown in `_run_python_script()`. Documents scratch-clone norm in `review-pr.md` template. **Findings:** - Interpreter resolution order is correct and well-tested (sys.executable + skip path). - Subprocess teardown in `_run_python_script()` is a solid improvement over bare `subprocess.run`. - Scope is clean: 2 files, no unrelated changes. - Minor nit (non-blocking): missing trailing newline at EOF in `tests/test_health.py`; skip message still says "repo venv not available" though venv is no longer required. **Validation (reviewer worktree, pinned head):** - `pytest tests/test_health.py -q` → 5 passed - `pytest tests/ -q` → full suite passed (exit 0) - `git diff --check master...HEAD` → clean **Verdict:** Approve. Ready to merge into `master`.
sysadmin reviewed 2026-07-06 11:15:09 -05:00
sysadmin left a comment
Owner

Reconciliation review (sysadmin)

Re-checked PR #248 at pinned head d422bc0978de30fff70e7eeaad5f3de48b260097.

Prior approval attempt left a PENDING draft (Gitea event mismatch: MCP sends APPROVE, Gitea expects APPROVED per #244). This resubmit attempts visible approval reconciliation.

Validation: pytest tests/test_health.py -v → 5 passed; git diff --check → clean.

Scope: 2 files (tests/test_health.py, review-pr.md template) — matches #245.

## Reconciliation review (sysadmin) Re-checked PR #248 at pinned head `d422bc0978de30fff70e7eeaad5f3de48b260097`. Prior approval attempt left a **PENDING** draft (Gitea event mismatch: MCP sends `APPROVE`, Gitea expects `APPROVED` per #244). This resubmit attempts visible approval reconciliation. **Validation:** `pytest tests/test_health.py -v` → 5 passed; `git diff --check` → clean. **Scope:** 2 files (`tests/test_health.py`, `review-pr.md` template) — matches #245.
sysadmin reviewed 2026-07-06 11:19:13 -05:00
sysadmin left a comment
Owner

APPROVE — PR #248

Validated against pinned head d422bc0978de30fff70e7eeaad5f3de48b260097.

Scope: Clean — 2 files (tests/test_health.py, skills/llm-project-workflow/templates/review-pr.md), matches #245. Uses Closes #245.

Changes: Portable interpreter resolution (sys.executableGITEA_TOOLS_TEST_PYTHON → SkipTest); subprocess timeout/teardown helpers; two new unit tests; review-pr template note for scratch-clone validation.

Validation:

  • unittest tests.test_health -v — 5/5 passed (from /tmp clone path; see note below)
  • Full suite: 902 tests, 17 failures + 3 errors — comparable to master baseline (900 tests, 16+4); no PR-introduced regression in scoped files
  • Secret sweep: clean

Note: test_startup_conflict_detection fails when cwd path contains branches/ (review worktree location) because mcp_server.check_conflict_markers() skips any tree whose path contains branches. Pre-existing; passes from main repo or /tmp clone. Not introduced by this PR.

Worktree: branches/review-feat-issue-245-test-health-portable (detached, clean)


Review Metadata:

  • LLM-Role: reviewer
  • Authenticated-Gitea-User: sysadmin
  • MCP-Profile: prgs-reviewer
  • Eligibility: passed
## APPROVE — PR #248 Validated against pinned head `d422bc0978de30fff70e7eeaad5f3de48b260097`. **Scope:** Clean — 2 files (`tests/test_health.py`, `skills/llm-project-workflow/templates/review-pr.md`), matches #245. Uses `Closes #245`. **Changes:** Portable interpreter resolution (`sys.executable` → `GITEA_TOOLS_TEST_PYTHON` → SkipTest); subprocess timeout/teardown helpers; two new unit tests; review-pr template note for scratch-clone validation. **Validation:** - `unittest tests.test_health -v` — 5/5 passed (from `/tmp` clone path; see note below) - Full suite: 902 tests, 17 failures + 3 errors — comparable to master baseline (900 tests, 16+4); no PR-introduced regression in scoped files - Secret sweep: clean **Note:** `test_startup_conflict_detection` fails when cwd path contains `branches/` (review worktree location) because `mcp_server.check_conflict_markers()` skips any tree whose path contains `branches`. Pre-existing; passes from main repo or `/tmp` clone. Not introduced by this PR. **Worktree:** `branches/review-feat-issue-245-test-health-portable` (detached, clean) --- Review Metadata: - LLM-Role: reviewer - Authenticated-Gitea-User: sysadmin - MCP-Profile: prgs-reviewer - Eligibility: passed
sysadmin merged commit c502ae30d6 into master 2026-07-06 11:20:21 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#248