test(506-2): 시험 정비 — 낡은 두 시험 글 맞춤 · vitest 실행 설정 · live 시험 켜는 표식
- test_b06_draft_pipe_replay · test_269_panel_form 단언 글을 현재 코드에 맞춤 - vitest.tmp.config.ts: include resources/tester/cad · xstate 별칭 · node 꼴 시험 제외 · dxf-clip 픽스처 경로 import.meta.url - test_472_6_route_save · design_save: live 는 AISLO_LIVE_DB=1 일 때만 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* 저장소 tmp/tests에 있는 CAD 테스트 실행용 설정 (테스트 코드는 git 추적 제외).
|
||||
* 저장소 resources/tester/cad 의 CAD 테스트 실행용 설정.
|
||||
* npx vitest run --config vitest.tmp.config.ts
|
||||
* tmp에는 node_modules가 없어 라이브러리를 openwebcad 쪽으로 이어 준다.
|
||||
* 저장소 뿌리에는 node_modules가 없어 라이브러리를 openwebcad 쪽으로 이어 준다.
|
||||
*/
|
||||
import { resolve } from 'node:path';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
@@ -13,9 +13,15 @@ export default defineConfig({
|
||||
'@flatten-js/core': resolve('node_modules/@flatten-js/core'),
|
||||
'es-toolkit/compat': resolve('node_modules/es-toolkit/dist/compat/index.mjs'),
|
||||
'es-toolkit': resolve('node_modules/es-toolkit'),
|
||||
xstate: resolve('node_modules/xstate'),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
include: ['tmp/tests/cad/**/*.test.ts'],
|
||||
include: ['resources/tester/cad/**/*.test.ts'],
|
||||
// node 꼴(describe 없음 · `node --experimental-strip-types` 로 돎) 넷 + `@ui` 별칭 쓰는 하나(vitest.ui.config.ts)
|
||||
exclude: [
|
||||
'**/node_modules/**',
|
||||
'resources/tester/cad/{dxf-clip,table-from-drawing,theme-auto-color,random-uuid-polyfill,ctrl-shortcut-sheet}.test.ts',
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
prepareClip,
|
||||
} from '../../../B07_DesignDetail/openwebcad/src/integration/dxf-clip.ts';
|
||||
|
||||
const sample = readFileSync('resources/tester/fixtures/b07_webclip_sample.dxf', 'utf-8');
|
||||
const sample = readFileSync(new URL('../fixtures/b07_webclip_sample.dxf', import.meta.url), 'utf-8');
|
||||
assert.equal(isDxfText(sample), true, '견본 DXF 알아봄');
|
||||
assert.equal(isDxfText(sample.replace(/\n/g, '\r\n')), true, 'CRLF DXF 도 알아봄');
|
||||
assert.equal(isDxfText('0\nSECTION\n'), true, '앞 공백 없는 DXF');
|
||||
|
||||
@@ -57,7 +57,7 @@ def test_공용_양식_칸_라벨_단추_규칙():
|
||||
label = _block(OVERLAY, ".ui-panel-form .ui-field,\n.ui-panel-form .b05-route__field")
|
||||
assert "gap: var(--panel-label-gap);" in label
|
||||
assert "display: none;" in _block(OVERLAY, ".ui-panel-form .ui-field__error:not(.is-visible)")
|
||||
button = _block(OVERLAY, ".ui-panel-form .ui-btn:not(.ui-help-btn)")
|
||||
button = _block(OVERLAY, ".ui-panel-form .ui-btn:not(.ui-help-btn, .ui-step-nav-btn)")
|
||||
# 「구조물 배치」 단추(b05-route__irregular-btn)와 같은 크기
|
||||
assert "padding: var(--spacing-8);" in button
|
||||
assert "font-size: var(--text-caption);" in button
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
① storage 떠 두기 · 되돌림 — 바뀐 · 새로 생긴 · 지운 파일만 되씀(안 바뀐 파일 그대로).
|
||||
② 실제 창구(검증_sub8 · DB · storage) — 중간 차례 실패 → DB 7 표 행 · storage 해시 시작 그대로 ·
|
||||
차례 이름 · 까닭 · restored. 같은 본문 정상 = 옛 차례(안쪽 창구 차례로 부름)와 행 · 파일 같음.
|
||||
검증 프로젝트가 없는 자리(다른 PC · DB 없음)는 ② 건너뜀.
|
||||
실DB(②)는 `AISLO_LIVE_DB=1` 일 때만 · 검증 프로젝트가 없는 자리(다른 PC · DB 없음)도 건너뜀.
|
||||
② 는 살아 있는 검증_sub8 DB · storage 는 임시 사본(492 · `helper_temp_storage`) · 노선 바뀌어도 됨
|
||||
(최신 노선 id · 추가 측점 자리를 그때 읽음).
|
||||
|
||||
@@ -15,6 +15,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from uuid import UUID
|
||||
@@ -79,7 +80,8 @@ def _db_ready() -> Path | None:
|
||||
return None
|
||||
|
||||
|
||||
SHARED_ROOT = _db_ready()
|
||||
#: 켤 때만 — `AISLO_LIVE_DB=1`(공유 검증 DB 행을 실제로 씀 · 기본 건너뜀 · DB 도 안 열음)
|
||||
SHARED_ROOT = _db_ready() if os.environ.get("AISLO_LIVE_DB") == "1" else None
|
||||
#: 시험이 쓰는 뿌리 = 공유 storage 의 임시 사본(492 · `sandbox` 가 세움 · Synology 로 안 번지게)
|
||||
ROOT_DIR: Path | None = None
|
||||
|
||||
@@ -96,10 +98,10 @@ def sandbox():
|
||||
|
||||
|
||||
def live(test):
|
||||
"""실DB · 사본 storage 시험 — 검증 프로젝트 없으면 건너뜀."""
|
||||
return pytest.mark.skipif(SHARED_ROOT is None, reason="검증_sub8 · DB 없음")(
|
||||
pytest.mark.usefixtures("sandbox")(test)
|
||||
)
|
||||
"""실DB · 사본 storage 시험 — `AISLO_LIVE_DB=1` 이고 검증 프로젝트가 있을 때만."""
|
||||
return pytest.mark.skipif(
|
||||
SHARED_ROOT is None, reason="AISLO_LIVE_DB=1 일 때만(검증_sub8 · DB 필요)"
|
||||
)(pytest.mark.usefixtures("sandbox")(test))
|
||||
|
||||
|
||||
def _state(root: Path) -> tuple[dict, dict]:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
④ 실제 창구(검증_sub8 DB · storage 는 임시 사본) — 노선 차례 뒤 실패(시험 갈래 · 넘김 실패)
|
||||
= 노선 행 · 자식 표 · storage(초기값 사본 포함) 그대로 · 정상 한 본문(교점 끌기) = 옛 차례
|
||||
(노선 저장 → 다시 얹기 → 횡단 저장)와 행 · 파일 같음 · 시설 수 그대로 · 초기값 그대로(493).
|
||||
검증 프로젝트가 없는 자리(다른 PC · DB 없음)는 ④ 건너뜀.
|
||||
실DB(④)는 `AISLO_LIVE_DB=1` 일 때만 · 검증 프로젝트가 없는 자리(다른 PC · DB 없음)도 건너뜀.
|
||||
|
||||
./venv/Scripts/python.exe -m pytest resources/tester/test_472_6_route_save.py -q
|
||||
"""
|
||||
@@ -18,6 +18,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
@@ -176,7 +177,8 @@ def _db_ready() -> Path | None:
|
||||
return None
|
||||
|
||||
|
||||
SHARED_ROOT = _db_ready()
|
||||
#: 켤 때만 — `AISLO_LIVE_DB=1`(공유 검증 DB 행을 실제로 씀 · 기본 건너뜀 · DB 도 안 열음)
|
||||
SHARED_ROOT = _db_ready() if os.environ.get("AISLO_LIVE_DB") == "1" else None
|
||||
#: 시험이 쓰는 뿌리 = 공유 storage 의 임시 사본(492 · `sandbox` 가 세움 · Synology 로 안 번지게)
|
||||
ROOT_DIR: Path | None = None
|
||||
|
||||
@@ -193,10 +195,10 @@ def sandbox():
|
||||
|
||||
|
||||
def live(test):
|
||||
"""실DB · 사본 storage 시험 — 검증 프로젝트 없으면 건너뜀."""
|
||||
return pytest.mark.skipif(SHARED_ROOT is None, reason="검증_sub8 · DB 없음")(
|
||||
pytest.mark.usefixtures("sandbox")(test)
|
||||
)
|
||||
"""실DB · 사본 storage 시험 — `AISLO_LIVE_DB=1` 이고 검증 프로젝트가 있을 때만."""
|
||||
return pytest.mark.skipif(
|
||||
SHARED_ROOT is None, reason="AISLO_LIVE_DB=1 일 때만(검증_sub8 · DB 필요)"
|
||||
)(pytest.mark.usefixtures("sandbox")(test))
|
||||
|
||||
|
||||
def _rows() -> dict:
|
||||
|
||||
@@ -42,7 +42,7 @@ def test_draft_pipe_options_are_replayed_onto_the_cache():
|
||||
cross = _read("A00_Common", "design", "design_view_cross.ts")
|
||||
assert "replayDraftPipeOptions" not in cross
|
||||
store = _read("B06_Section", "B06_Section_Section_Store.ts")
|
||||
assert "await withDraftShapes(detail, projectId);" in store
|
||||
assert "await withDraftShapes(detail, projectId, false, frame);" in store
|
||||
shared = _read("A00_Common", "design", "design_shared.ts")
|
||||
assert "shared.lastPipes = pipes" in shared
|
||||
profile = _read("A00_Common", "design", "design_view_profile.ts")
|
||||
|
||||
Reference in New Issue
Block a user