(tmp_path, monkeypatch)
| 54 | |
| 55 | |
| 56 | def test_log_query_appends(tmp_path, monkeypatch): |
| 57 | log_file = tmp_path / "q.log" |
| 58 | monkeypatch.setenv("GRAPHIFY_QUERY_LOG", str(log_file)) |
| 59 | monkeypatch.delenv("GRAPHIFY_QUERY_LOG_DISABLE", raising=False) |
| 60 | |
| 61 | log_query(kind="query", question="q1", corpus="/g.json") |
| 62 | log_query(kind="query", question="q2", corpus="/g.json") |
| 63 | |
| 64 | lines = log_file.read_text().splitlines() |
| 65 | assert len(lines) == 2 |
| 66 | assert json.loads(lines[0])["question"] == "q1" |
| 67 | assert json.loads(lines[1])["question"] == "q2" |
| 68 | |
| 69 | |
| 70 | # --------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected