migration: prove standalone maintenance and correct visual evidence
This commit is contained in:
@@ -21,6 +21,39 @@ def run(label: str, command: list[str]) -> None:
|
||||
subprocess.run(command, cwd=ROOT, check=True)
|
||||
|
||||
|
||||
def python_test_command(preservation_baseline: bool | None = None) -> list[str]:
|
||||
if preservation_baseline is None:
|
||||
preservation_baseline = (ROOT.parent / "static" / "app.js").is_file()
|
||||
if preservation_baseline:
|
||||
return [sys.executable, "-m", "unittest", "discover", "-s", "tests"]
|
||||
modules = [
|
||||
f"tests.{path.stem}"
|
||||
for path in sorted((ROOT / "tests").glob("test_*.py"))
|
||||
if not path.stem.startswith("test_preservation_")
|
||||
]
|
||||
if not modules:
|
||||
raise RuntimeError("no standalone candidate tests found")
|
||||
return [sys.executable, "-m", "unittest", *modules]
|
||||
|
||||
|
||||
def verify_git_diff() -> None:
|
||||
result = subprocess.run(
|
||||
["git", "rev-parse", "--show-toplevel"],
|
||||
cwd=ROOT,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("\n[patch] skipped: standalone export is not a Git checkout")
|
||||
return
|
||||
repository_root = Path(result.stdout.strip()).resolve()
|
||||
if ROOT != repository_root / "app":
|
||||
print("\n[patch] skipped: standalone export is outside the canonical app path")
|
||||
return
|
||||
run("patch", ["git", "diff", "--check"])
|
||||
|
||||
|
||||
def verify_database() -> None:
|
||||
database = ROOT / "data" / "review.db"
|
||||
if not database.exists():
|
||||
@@ -97,7 +130,7 @@ def main() -> int:
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
run("python", [sys.executable, "-m", "unittest", "discover", "-s", "tests"])
|
||||
run("python", python_test_command())
|
||||
run(
|
||||
"api-registry",
|
||||
[sys.executable, "tools/build_api_registry.py", "--check"],
|
||||
@@ -117,7 +150,7 @@ def main() -> int:
|
||||
"javascript",
|
||||
[node, "--check", script.relative_to(ROOT).as_posix()],
|
||||
)
|
||||
run("patch", ["git", "diff", "--check"])
|
||||
verify_git_diff()
|
||||
verify_database()
|
||||
|
||||
if args.e2e:
|
||||
|
||||
Reference in New Issue
Block a user