Kind07's picture
Initial clean commit for web deployment
ed65693
Raw
History Blame Contribute Delete
801 Bytes
import pytest
from fastapi.testclient import TestClient
@pytest.fixture()
def client(tmp_path, monkeypatch):
import app.main as main
import app.retriever as retriever
upload_dir = tmp_path / "uploads"
index_dir = tmp_path / "faiss_index"
monkeypatch.setattr(retriever, "UPLOAD_DIR", upload_dir)
monkeypatch.setattr(retriever, "INDEX_DIR", index_dir)
monkeypatch.setattr(retriever, "BM25_INDEX_PATH", index_dir / "bm25_index.pkl")
monkeypatch.setattr(retriever, "DOC_LOOKUP_PATH", index_dir / "doc_lookup.pkl")
monkeypatch.setattr(retriever, "CORPUS_LM_PATH", index_dir / "corpus_lm.pkl")
monkeypatch.setattr(main, "UPLOAD_DIR", upload_dir)
main.store = retriever.DocumentStore()
with TestClient(main.app) as test_client:
yield test_client