"""테스트 공용 격리. `/ingest` 는 적재 후 백그라운드로 요약 → **위키 생성**까지 이어 돌린다. TestClient 는 백그라운드 작업을 동기로 실행하므로, `wiki_dir` 을 격리하지 않은 테스트가 실제 `wiki/` 에 파일을 쓸 수 있다 (실제로 `wiki/programs/ZBK_T1.md` 가 새어 나온 적이 있다). 테스트가 직접 monkeypatch 하면 그 값이 이기므로(autouse 가 먼저 적용된다) 안전망으로만 동작한다. """ from __future__ import annotations import pytest from config.settings import settings @pytest.fixture(autouse=True) def _isolate_writable_dirs(tmp_path_factory, monkeypatch): base = tmp_path_factory.mktemp("isolated") monkeypatch.setattr(settings, "wiki_dir", base / "wiki") monkeypatch.setattr(settings, "data_llm_jobs", base / "llm_jobs") yield