@@ -22,6 +22,7 @@ def mock_config(tmp_path, monkeypatch):
2222 from basic_memory import config as config_module
2323
2424 config_module ._CONFIG_CACHE = None
25+ config_module ._CONFIG_MTIME = None
2526
2627 config_dir = tmp_path / ".basic-memory"
2728 config_dir .mkdir (parents = True , exist_ok = True )
@@ -68,6 +69,7 @@ def test_set_cloud_no_credentials(self, runner, tmp_path, monkeypatch):
6869 from basic_memory import config as config_module
6970
7071 config_module ._CONFIG_CACHE = None
72+ config_module ._CONFIG_MTIME = None
7173
7274 config_dir = tmp_path / ".basic-memory"
7375 config_dir .mkdir (parents = True , exist_ok = True )
@@ -91,6 +93,7 @@ def test_set_cloud_with_oauth_session(self, runner, tmp_path, monkeypatch):
9193 from basic_memory import config as config_module
9294
9395 config_module ._CONFIG_CACHE = None
96+ config_module ._CONFIG_MTIME = None
9497
9598 config_dir = tmp_path / ".basic-memory"
9699 config_dir .mkdir (parents = True , exist_ok = True )
@@ -161,18 +164,21 @@ def test_set_local_clears_workspace_id(self, runner, mock_config):
161164
162165 # Manually set workspace_id on the project
163166 config_module ._CONFIG_CACHE = None
167+ config_module ._CONFIG_MTIME = None
164168 config_data = json .loads (mock_config .read_text ())
165169 config_data ["projects" ]["research" ]["mode" ] = "cloud"
166170 config_data ["projects" ]["research" ]["workspace_id" ] = "11111111-1111-1111-1111-111111111111"
167171 mock_config .write_text (json .dumps (config_data , indent = 2 ))
168172 config_module ._CONFIG_CACHE = None
173+ config_module ._CONFIG_MTIME = None
169174
170175 # Set back to local
171176 result = runner .invoke (app , ["project" , "set-local" , "research" ])
172177 assert result .exit_code == 0
173178
174179 # Verify workspace_id was cleared
175180 config_module ._CONFIG_CACHE = None
181+ config_module ._CONFIG_MTIME = None
176182 updated_data = json .loads (mock_config .read_text ())
177183 assert updated_data ["projects" ]["research" ]["workspace_id" ] is None
178184 assert updated_data ["projects" ]["research" ]["mode" ] == "local"
@@ -187,6 +193,7 @@ def test_set_cloud_with_workspace_stores_workspace_id(self, runner, mock_config,
187193 from basic_memory .schemas .cloud import WorkspaceInfo
188194
189195 config_module ._CONFIG_CACHE = None
196+ config_module ._CONFIG_MTIME = None
190197
191198 async def fake_get_available_workspaces ():
192199 return [
@@ -210,6 +217,7 @@ async def fake_get_available_workspaces():
210217
211218 # Verify workspace_id was persisted
212219 config_module ._CONFIG_CACHE = None
220+ config_module ._CONFIG_MTIME = None
213221 updated_data = json .loads (mock_config .read_text ())
214222 assert (
215223 updated_data ["projects" ]["research" ]["workspace_id" ]
@@ -222,6 +230,7 @@ def test_set_cloud_with_workspace_not_found(self, runner, mock_config, monkeypat
222230 from basic_memory .schemas .cloud import WorkspaceInfo
223231
224232 config_module ._CONFIG_CACHE = None
233+ config_module ._CONFIG_MTIME = None
225234
226235 async def fake_get_available_workspaces ():
227236 return [
@@ -249,17 +258,20 @@ def test_set_cloud_uses_default_workspace_when_no_flag(self, runner, mock_config
249258 from basic_memory import config as config_module
250259
251260 config_module ._CONFIG_CACHE = None
261+ config_module ._CONFIG_MTIME = None
252262
253263 # Set default_workspace in config
254264 config_data = json .loads (mock_config .read_text ())
255265 config_data ["default_workspace" ] = "global-default-tenant-id"
256266 mock_config .write_text (json .dumps (config_data , indent = 2 ))
257267 config_module ._CONFIG_CACHE = None
268+ config_module ._CONFIG_MTIME = None
258269
259270 result = runner .invoke (app , ["project" , "set-cloud" , "research" ])
260271 assert result .exit_code == 0
261272
262273 # Verify workspace_id was set from default
263274 config_module ._CONFIG_CACHE = None
275+ config_module ._CONFIG_MTIME = None
264276 updated_data = json .loads (mock_config .read_text ())
265277 assert updated_data ["projects" ]["research" ]["workspace_id" ] == "global-default-tenant-id"
0 commit comments