@@ -49,10 +49,8 @@ async def test_my_mcp_tool(mcp_server, app):
4949The `app` fixture ensures FastAPI dependency overrides are active, and
5050`mcp_server` provides the MCP server with proper project session initialization.
5151"""
52- import os
52+
5353from typing import AsyncGenerator
54- from unittest import mock
55- from unittest .mock import patch
5654
5755import pytest
5856import pytest_asyncio
@@ -110,21 +108,29 @@ async def test_project(tmp_path, engine_factory) -> Project:
110108 project = await project_repository .create (project_data )
111109 return project
112110
111+
113112@pytest .fixture
114113def config_home (tmp_path , monkeypatch ) -> Path :
115114 monkeypatch .setenv ("HOME" , str (tmp_path ))
116115 return tmp_path
117116
117+
118118@pytest .fixture (scope = "function" )
119119def app_config (config_home , test_project , tmp_path , monkeypatch ) -> BasicMemoryConfig :
120120 """Create test app configuration."""
121121 projects = {test_project .name : str (test_project .path )}
122- app_config = BasicMemoryConfig (env = "test" , projects = projects , default_project = test_project .name , update_permalinks_on_move = True )
122+ app_config = BasicMemoryConfig (
123+ env = "test" ,
124+ projects = projects ,
125+ default_project = test_project .name ,
126+ update_permalinks_on_move = True ,
127+ )
123128
124129 # Set the module app_config instance project list (like regular tests)
125130 monkeypatch .setattr ("basic_memory.config.app_config" , app_config )
126131 return app_config
127132
133+
128134@pytest .fixture
129135def config_manager (app_config : BasicMemoryConfig , config_home , monkeypatch ) -> ConfigManager :
130136 config_manager = ConfigManager ()
@@ -145,6 +151,7 @@ def config_manager(app_config: BasicMemoryConfig, config_home, monkeypatch) -> C
145151
146152 return config_manager
147153
154+
148155@pytest .fixture
149156def project_session (test_project : Project ):
150157 # initialize the project session with the test project
@@ -166,9 +173,10 @@ def project_config(test_project, monkeypatch):
166173 return project_config
167174
168175
169-
170176@pytest .fixture (scope = "function" )
171- def app (app_config , project_config , engine_factory , test_project , project_session , config_manager ) -> FastAPI :
177+ def app (
178+ app_config , project_config , engine_factory , test_project , project_session , config_manager
179+ ) -> FastAPI :
172180 """Create test FastAPI application with single project."""
173181
174182 app = fastapi_app
@@ -228,4 +236,4 @@ def mcp_server(app_config, search_service):
228236async def client (app : FastAPI ) -> AsyncGenerator [AsyncClient , None ]:
229237 """Create test client that both MCP and tests will use."""
230238 async with AsyncClient (transport = ASGITransport (app = app ), base_url = "http://test" ) as client :
231- yield client
239+ yield client
0 commit comments