File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,6 +149,22 @@ def clean_routing_env(monkeypatch) -> None:
149149 monkeypatch .delenv ("BASIC_MEMORY_EXPLICIT_ROUTING" , raising = False )
150150
151151
152+ @pytest .fixture (autouse = True )
153+ def isolate_data_dir_env (monkeypatch ) -> None :
154+ """Keep host data-dir env vars from leaking into integration tests.
155+
156+ Why: GitHub Actions Ubuntu runners set ``XDG_CONFIG_HOME=/home/runner/.config``,
157+ and ``resolve_data_dir()`` honors it ahead of ``Path.home() / ".basic-memory"``.
158+ Without clearing it, the MCP tool process reads config.json from the host XDG
159+ path instead of the tmp dir the ``config_manager`` fixture wrote to — so
160+ ``test-project`` is missing from ``config.projects``, ``get_project_mode``
161+ falls through to its CLOUD default (#837), and every tool call fails with
162+ "Cloud routing requested but no credentials found."
163+ """
164+ monkeypatch .delenv ("BASIC_MEMORY_CONFIG_DIR" , raising = False )
165+ monkeypatch .delenv ("XDG_CONFIG_HOME" , raising = False )
166+
167+
152168POSTGRES_EPHEMERAL_TABLES = [
153169 "search_vector_embeddings" ,
154170 "search_vector_chunks" ,
Original file line number Diff line number Diff line change @@ -225,6 +225,19 @@ def isolate_routing_env(monkeypatch) -> None:
225225 monkeypatch .delenv ("BASIC_MEMORY_EXPLICIT_ROUTING" , raising = False )
226226
227227
228+ @pytest .fixture (autouse = True )
229+ def isolate_data_dir_env (monkeypatch ) -> None :
230+ """Keep host data-dir env vars from leaking into tests.
231+
232+ Why: GitHub Actions Ubuntu runners set ``XDG_CONFIG_HOME=/home/runner/.config``,
233+ and ``resolve_data_dir()`` honors it ahead of ``Path.home() / ".basic-memory"``.
234+ Without clearing it, tests that monkeypatch HOME still see the host XDG path
235+ and assertions against the tmp home directory fail.
236+ """
237+ monkeypatch .delenv ("BASIC_MEMORY_CONFIG_DIR" , raising = False )
238+ monkeypatch .delenv ("XDG_CONFIG_HOME" , raising = False )
239+
240+
228241@pytest_asyncio .fixture (autouse = True )
229242async def cleanup_global_db_after_test () -> AsyncGenerator [None , None ]:
230243 """Close any module-level DB engine created outside fixture ownership."""
You can’t perform that action at this time.
0 commit comments