Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

test: fix test_get_client_missing_file for CI env without OPENAI_API_KEY

yifanfeng974be704ac8797
diff --git a/tests/utils/test_client.py b/tests/utils/test_client.py
index 7f25481..cbc6b99 100644
--- a/tests/utils/test_client.py
+++ b/tests/utils/test_client.py
@@ -289,7 +289,8 @@ class TestGetClient:
def test_get_client_missing_file(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
"""Missing config file returns default configs."""
- # Clear env vars that could interfere with base_url resolution
+ # Ensure consistent environment for default OpenAI fallback
+ monkeypatch.setenv("OPENAI_API_KEY", "sk-test")
monkeypatch.delenv("OPENAI_BASE_URL", raising=False)
config_file = tmp_path / "nonexistent.toml"
llm, emb = get_client(config_file)