Files
Aislo/resources/tester/helper_verify_project.py
T
eomsangdonandClaude Sonnet 5.5 026ca74c52 test(507-4): 검증 스크립트 정비 — 계산 자리 화면 시험 안전장치 · 505-3 교각점 요소 자리 · 검증_sub7 시험 12 파일 지금 검증 프로젝트로 · 공용 TS 불러오기 첫 걸음
- 309-2 화면 시험: 5177 이 8004 로 갈 때만 돎(남의 마스터 안 씀) · 실패해도 판 되돌림(finally) · 읽기는 서버 응답으로 판정
- 505-3 첫 시험: 픽셀 (1199,296) 대신 캔버스 교각점 색으로 찾음 · 포트 · 프로젝트는 환경 변수로
- 349 계열 · 346-2 · 356-4: helper_verify_project 가 OWNERS.md 검증_subN 중 가장 오래 안 바뀐 프로젝트를 읽기만 · 없으면 까닭 글로 건너뜀 · 낡은 기대 xfail
- helper_ts_stub_loader 공용 불러오기 + 새 시험 · 헬퍼 3 곳 옮김

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 16:02:51 +09:00

65 lines
2.9 KiB
Python

"""검증 프로젝트 찾기 — 읽기만 하는 시험이 필요한 파일을 가진 storage 프로젝트 하나를 고름(507-4).
옛 시험은 지워진 검증_sub7 의 uuid 를 박아 늘 건너뜀 → 지금 storage 에 있는 프로젝트 가운데
OWNERS.md 의 검증_subN 가운데 필요한 파일이 다 있고 가장 오래 안 바뀐 것을 씀(쓰는 중인 프로젝트 피함). `AISLO_TEST_PROJECT=<uuid>` 로 고정 가능. 없으면
`NONE` 경로(존재하지 않음) 를 돌려줘 시험이 `SKIP_REASON` 글로 건너뜀. 쓰는 시험 금지(읽기 전용).
"""
from __future__ import annotations
import os
import re
import pytest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
NONE = ROOT / "storage" / "_no_verify_project"
SKIP_REASON = "검증 프로젝트 없음 — storage/*/*/ 에 필요한 파일(격자 · 종단 · 노선 · 관)을 다 가진 프로젝트가 없음"
#: B05 노선 · B06 상세 · 관 · 격자를 쓰는 349 계열 시험이 읽는 파일
ROUTE_SET = (
"B04_PreProcess/models/dtm_classification_smooth.npz",
"B06_Section/longitudinal/longitudinal.json",
"B05_Profile/route/planned_route_curves.json",
"B05_Profile/route/planned_route.csv",
"B05_Profile/route/planned_route_nodes.csv",
"B04_PreProcess/drainage/edits/pipe_points.json",
)
def _verify_ids() -> set[str]:
"""OWNERS.md 표의 검증_subN 프로젝트 uuid — 사용자 프로젝트(엄상준_검증 등)는 시험이 안 열음."""
text = (ROOT / "OWNERS.md").read_text(encoding="utf-8")
return set(re.findall(r"`검증_sub\d+`\s*\|\s*`([0-9a-f-]{36})`", text))
def _touched(project: Path, rels: tuple[str, ...]) -> float:
"""가장 늦게 바뀐 때 — 다른 창이 쓰는 중인 프로젝트(최근)는 뒤로."""
sections = project / "B06_Section" / "cross_sections"
stamps = [(project / rel).stat().st_mtime for rel in rels] + [sections.stat().st_mtime]
return max(stamps + [f.stat().st_mtime for f in sections.glob("*.json")])
def find_project(*rels: str) -> Path:
pinned = os.environ.get("AISLO_TEST_PROJECT")
candidates = (
list((ROOT / "storage").glob(f"*/*/{pinned}"))
if pinned
else [p for p in (ROOT / "storage").glob("*/*/*") if p.name in _verify_ids()]
)
found = [
project
for project in candidates
if all((project / rel).is_file() for rel in rels)
and (project / "B06_Section" / "cross_sections").is_dir()
]
return min(found, key=lambda project: _touched(project, rels), default=NONE)
#: 검증 프로젝트로 처음 돌려 본 때(507-4) 이미 빨강 — 대부분 프로젝트와 무관(여섯 프로젝트 같음) · 옛 기대가 낡았는지 제품 흠인지 가려질 때까지(0q 메아리 = 돌 때마다 흔들림)
DRIFT = pytest.mark.xfail(
strict=False,
reason="507-4: 검증 프로젝트로 돌리니 빨강 · 흔들림 — 기대 낡음 또는 제품 흠(브레인 가림 전)",
)