wip: local BUG-139/BUG-140 fixes before syncing origin/main
- pre_work_check.py: prefer repo .venv Python >=3.11, strict JYOTISH_PRE_WORK_PYTHON override, fail closed - tests/test_pre_work_check.py: regression coverage for venv preference / system 3.9 / strict override - globals.css: transient :active pressed feedback for entrypoint cards, hover only under (hover: hover) - consultation-entrypoint.test.ts: sticky-hover regression test - BUG_HISTORY.md: BUG-139 / BUG-140 records - pre_work_error_ledger.md: ERR-078 resolved entry
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from scripts.pre_work_check import (
|
||||
DEFAULT_COMMAND_TIMEOUT_SECONDS,
|
||||
DEFAULT_FRAGMENT_TIMEOUT_SECONDS,
|
||||
EXTERNAL_ENGINE_DIAGNOSTIC_TARGET,
|
||||
FOCUSED_TEST_TARGETS,
|
||||
PRE_WORK_DOCS,
|
||||
PYTHON_OVERRIDE_ENV,
|
||||
classify_status,
|
||||
python_candidates,
|
||||
select_python,
|
||||
)
|
||||
|
||||
|
||||
@@ -14,6 +19,55 @@ def test_classify_status_keeps_remote_blocked_distinct_from_failure() -> None:
|
||||
assert classify_status(True, True, True, "verified") == "pass"
|
||||
assert classify_status(True, True, True, "blocked") == "pass_with_remote_blocked"
|
||||
assert classify_status(True, True, False, "verified") == "fail"
|
||||
assert classify_status(True, True, True, "verified", python_ok=False) == "fail"
|
||||
|
||||
|
||||
def test_pre_work_check_prefers_project_venv_over_launching_python(tmp_path: Path) -> None:
|
||||
candidates = python_candidates(root=tmp_path, environ={}, current_executable="/usr/bin/python3")
|
||||
|
||||
assert candidates[0] == str(tmp_path / ".venv" / "bin" / "python")
|
||||
assert candidates[1] == str(tmp_path / ".venv" / "Scripts" / "python.exe")
|
||||
assert candidates[2] == "/usr/bin/python3"
|
||||
|
||||
|
||||
def test_pre_work_check_python_override_is_strict() -> None:
|
||||
candidates = python_candidates(
|
||||
environ={PYTHON_OVERRIDE_ENV: "/opt/project-python"},
|
||||
current_executable="/usr/bin/python3",
|
||||
)
|
||||
|
||||
assert candidates == ["/opt/project-python"]
|
||||
|
||||
|
||||
def test_pre_work_check_skips_incompatible_launcher_and_selects_venv() -> None:
|
||||
results = {
|
||||
"/usr/bin/python3": {
|
||||
"candidate": "/usr/bin/python3",
|
||||
"ok": False,
|
||||
"version": "3.9.6",
|
||||
"pytest_available": False,
|
||||
"error": "Python 3.9 is below required 3.11; pytest is not installed",
|
||||
},
|
||||
".venv/bin/python": {
|
||||
"candidate": ".venv/bin/python",
|
||||
"ok": True,
|
||||
"version": "3.11.15",
|
||||
"pytest_available": True,
|
||||
"error": "",
|
||||
},
|
||||
}
|
||||
|
||||
selected = select_python(
|
||||
["/usr/bin/python3", ".venv/bin/python"],
|
||||
probe=lambda candidate: results[candidate],
|
||||
)
|
||||
|
||||
assert selected["ok"] is True
|
||||
assert selected["executable"] == ".venv/bin/python"
|
||||
assert [attempt["candidate"] for attempt in selected["attempts"]] == [
|
||||
"/usr/bin/python3",
|
||||
".venv/bin/python",
|
||||
]
|
||||
|
||||
|
||||
def test_pre_work_check_runs_governance_test_set() -> None:
|
||||
|
||||
Reference in New Issue
Block a user