@@ -22,6 +22,8 @@ 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
26+ config_module ._CONFIG_SIZE = None
2527
2628 config_dir = tmp_path / ".basic-memory"
2729 config_dir .mkdir (parents = True , exist_ok = True )
@@ -68,6 +70,8 @@ def test_set_cloud_no_credentials(self, runner, tmp_path, monkeypatch):
6870 from basic_memory import config as config_module
6971
7072 config_module ._CONFIG_CACHE = None
73+ config_module ._CONFIG_MTIME = None
74+ config_module ._CONFIG_SIZE = None
7175
7276 config_dir = tmp_path / ".basic-memory"
7377 config_dir .mkdir (parents = True , exist_ok = True )
@@ -91,6 +95,8 @@ def test_set_cloud_with_oauth_session(self, runner, tmp_path, monkeypatch):
9195 from basic_memory import config as config_module
9296
9397 config_module ._CONFIG_CACHE = None
98+ config_module ._CONFIG_MTIME = None
99+ config_module ._CONFIG_SIZE = None
94100
95101 config_dir = tmp_path / ".basic-memory"
96102 config_dir .mkdir (parents = True , exist_ok = True )
@@ -161,18 +167,24 @@ def test_set_local_clears_workspace_id(self, runner, mock_config):
161167
162168 # Manually set workspace_id on the project
163169 config_module ._CONFIG_CACHE = None
170+ config_module ._CONFIG_MTIME = None
171+ config_module ._CONFIG_SIZE = None
164172 config_data = json .loads (mock_config .read_text ())
165173 config_data ["projects" ]["research" ]["mode" ] = "cloud"
166174 config_data ["projects" ]["research" ]["workspace_id" ] = "11111111-1111-1111-1111-111111111111"
167175 mock_config .write_text (json .dumps (config_data , indent = 2 ))
168176 config_module ._CONFIG_CACHE = None
177+ config_module ._CONFIG_MTIME = None
178+ config_module ._CONFIG_SIZE = None
169179
170180 # Set back to local
171181 result = runner .invoke (app , ["project" , "set-local" , "research" ])
172182 assert result .exit_code == 0
173183
174184 # Verify workspace_id was cleared
175185 config_module ._CONFIG_CACHE = None
186+ config_module ._CONFIG_MTIME = None
187+ config_module ._CONFIG_SIZE = None
176188 updated_data = json .loads (mock_config .read_text ())
177189 assert updated_data ["projects" ]["research" ]["workspace_id" ] is None
178190 assert updated_data ["projects" ]["research" ]["mode" ] == "local"
@@ -187,6 +199,8 @@ def test_set_cloud_with_workspace_stores_workspace_id(self, runner, mock_config,
187199 from basic_memory .schemas .cloud import WorkspaceInfo
188200
189201 config_module ._CONFIG_CACHE = None
202+ config_module ._CONFIG_MTIME = None
203+ config_module ._CONFIG_SIZE = None
190204
191205 async def fake_get_available_workspaces ():
192206 return [
@@ -210,6 +224,8 @@ async def fake_get_available_workspaces():
210224
211225 # Verify workspace_id was persisted
212226 config_module ._CONFIG_CACHE = None
227+ config_module ._CONFIG_MTIME = None
228+ config_module ._CONFIG_SIZE = None
213229 updated_data = json .loads (mock_config .read_text ())
214230 assert (
215231 updated_data ["projects" ]["research" ]["workspace_id" ]
@@ -222,6 +238,8 @@ def test_set_cloud_with_workspace_not_found(self, runner, mock_config, monkeypat
222238 from basic_memory .schemas .cloud import WorkspaceInfo
223239
224240 config_module ._CONFIG_CACHE = None
241+ config_module ._CONFIG_MTIME = None
242+ config_module ._CONFIG_SIZE = None
225243
226244 async def fake_get_available_workspaces ():
227245 return [
@@ -249,17 +267,23 @@ def test_set_cloud_uses_default_workspace_when_no_flag(self, runner, mock_config
249267 from basic_memory import config as config_module
250268
251269 config_module ._CONFIG_CACHE = None
270+ config_module ._CONFIG_MTIME = None
271+ config_module ._CONFIG_SIZE = None
252272
253273 # Set default_workspace in config
254274 config_data = json .loads (mock_config .read_text ())
255275 config_data ["default_workspace" ] = "global-default-tenant-id"
256276 mock_config .write_text (json .dumps (config_data , indent = 2 ))
257277 config_module ._CONFIG_CACHE = None
278+ config_module ._CONFIG_MTIME = None
279+ config_module ._CONFIG_SIZE = None
258280
259281 result = runner .invoke (app , ["project" , "set-cloud" , "research" ])
260282 assert result .exit_code == 0
261283
262284 # Verify workspace_id was set from default
263285 config_module ._CONFIG_CACHE = None
286+ config_module ._CONFIG_MTIME = None
287+ config_module ._CONFIG_SIZE = None
264288 updated_data = json .loads (mock_config .read_text ())
265289 assert updated_data ["projects" ]["research" ]["workspace_id" ] == "global-default-tenant-id"
0 commit comments