Merge remote-tracking branch 'origin/main_laptop_1' into sub_laptop_6
This commit is contained in:
@@ -28,7 +28,8 @@ import master_text as mtx # noqa: E402
|
||||
from M01_MasterData import M01_MasterData_Store_Cache as cache # noqa: E402
|
||||
from M01_MasterData.M01_MasterData_Store_Shape import dump, keep_shape # noqa: E402
|
||||
|
||||
FOLDER: Path = cm.MASTER # 시험은 사본 폴더로 바꿈
|
||||
_COPY = os.environ.get("AISLO_MASTER_DIR") # 화면 저장 시험 사본 폴더(정함 13) · 없으면 정본
|
||||
FOLDER: Path = Path(_COPY).resolve() if _COPY else cm.MASTER # 시험은 사본 폴더로 바꿈
|
||||
DRAFT = "_초안.json" # 저장 안 한 새 로직을 얹는 메모리 자리 — 파일로 쓰지 않음
|
||||
_CHAPTER = re.compile(r"_(\d\d)장_(.+)\.json$") # 「_03장_토공사.json」
|
||||
# ponytail: 저장은 한 번에 하나(프로세스 안 잠금) · 서버를 여럿 띄우면 파일 잠금으로
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
"""흐름도 적용(PLAN 36-4 · 정함 13) — 마스터 사본 폴더 길 시험.
|
||||
|
||||
· 환경 변수 AISLO_MASTER_DIR 가 있으면 M01 저장소 마스터 폴더 = 그 폴더 · 없으면 정본
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
PROBE = "from M01_MasterData import M01_MasterData_Store as s; print(s.FOLDER)"
|
||||
|
||||
|
||||
def _folder(env_dir: str | None) -> Path:
|
||||
env = {k: v for k, v in os.environ.items() if k != "AISLO_MASTER_DIR"}
|
||||
if env_dir:
|
||||
env["AISLO_MASTER_DIR"] = env_dir
|
||||
got = subprocess.run(
|
||||
[sys.executable, "-c", PROBE],
|
||||
cwd=ROOT,
|
||||
env=env,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120,
|
||||
)
|
||||
assert got.returncode == 0, got.stderr
|
||||
return Path(got.stdout.strip().splitlines()[-1])
|
||||
|
||||
|
||||
def test_사본_폴더_변수가_있으면_그_폴더(tmp_path: Path) -> None:
|
||||
assert _folder(str(tmp_path)) == tmp_path.resolve()
|
||||
|
||||
|
||||
def test_변수가_없으면_정본() -> None:
|
||||
assert _folder(None) == (ROOT / "resources" / "master_data").resolve()
|
||||
Reference in New Issue
Block a user