@@ -23,6 +23,7 @@ def mock_config(tmp_path, monkeypatch):
2323
2424 config_module ._CONFIG_CACHE = None
2525 config_module ._CONFIG_MTIME = None
26+ config_module ._CONFIG_SIZE = None
2627
2728 config_dir = tmp_path / ".basic-memory"
2829 config_dir .mkdir (parents = True , exist_ok = True )
@@ -70,6 +71,7 @@ def test_set_cloud_no_credentials(self, runner, tmp_path, monkeypatch):
7071
7172 config_module ._CONFIG_CACHE = None
7273 config_module ._CONFIG_MTIME = None
74+ config_module ._CONFIG_SIZE = None
7375
7476 config_dir = tmp_path / ".basic-memory"
7577 config_dir .mkdir (parents = True , exist_ok = True )
@@ -94,6 +96,7 @@ def test_set_cloud_with_oauth_session(self, runner, tmp_path, monkeypatch):
9496
9597 config_module ._CONFIG_CACHE = None
9698 config_module ._CONFIG_MTIME = None
99+ config_module ._CONFIG_SIZE = None
97100
98101 config_dir = tmp_path / ".basic-memory"
99102 config_dir .mkdir (parents = True , exist_ok = True )
@@ -165,12 +168,14 @@ def test_set_local_clears_workspace_id(self, runner, mock_config):
165168 # Manually set workspace_id on the project
166169 config_module ._CONFIG_CACHE = None
167170 config_module ._CONFIG_MTIME = None
171+ config_module ._CONFIG_SIZE = None
168172 config_data = json .loads (mock_config .read_text ())
169173 config_data ["projects" ]["research" ]["mode" ] = "cloud"
170174 config_data ["projects" ]["research" ]["workspace_id" ] = "11111111-1111-1111-1111-111111111111"
171175 mock_config .write_text (json .dumps (config_data , indent = 2 ))
172176 config_module ._CONFIG_CACHE = None
173177 config_module ._CONFIG_MTIME = None
178+ config_module ._CONFIG_SIZE = None
174179
175180 # Set back to local
176181 result = runner .invoke (app , ["project" , "set-local" , "research" ])
@@ -179,6 +184,7 @@ def test_set_local_clears_workspace_id(self, runner, mock_config):
179184 # Verify workspace_id was cleared
180185 config_module ._CONFIG_CACHE = None
181186 config_module ._CONFIG_MTIME = None
187+ config_module ._CONFIG_SIZE = None
182188 updated_data = json .loads (mock_config .read_text ())
183189 assert updated_data ["projects" ]["research" ]["workspace_id" ] is None
184190 assert updated_data ["projects" ]["research" ]["mode" ] == "local"
@@ -194,6 +200,7 @@ def test_set_cloud_with_workspace_stores_workspace_id(self, runner, mock_config,
194200
195201 config_module ._CONFIG_CACHE = None
196202 config_module ._CONFIG_MTIME = None
203+ config_module ._CONFIG_SIZE = None
197204
198205 async def fake_get_available_workspaces ():
199206 return [
@@ -218,6 +225,7 @@ async def fake_get_available_workspaces():
218225 # Verify workspace_id was persisted
219226 config_module ._CONFIG_CACHE = None
220227 config_module ._CONFIG_MTIME = None
228+ config_module ._CONFIG_SIZE = None
221229 updated_data = json .loads (mock_config .read_text ())
222230 assert (
223231 updated_data ["projects" ]["research" ]["workspace_id" ]
@@ -231,6 +239,7 @@ def test_set_cloud_with_workspace_not_found(self, runner, mock_config, monkeypat
231239
232240 config_module ._CONFIG_CACHE = None
233241 config_module ._CONFIG_MTIME = None
242+ config_module ._CONFIG_SIZE = None
234243
235244 async def fake_get_available_workspaces ():
236245 return [
@@ -259,19 +268,22 @@ def test_set_cloud_uses_default_workspace_when_no_flag(self, runner, mock_config
259268
260269 config_module ._CONFIG_CACHE = None
261270 config_module ._CONFIG_MTIME = None
271+ config_module ._CONFIG_SIZE = None
262272
263273 # Set default_workspace in config
264274 config_data = json .loads (mock_config .read_text ())
265275 config_data ["default_workspace" ] = "global-default-tenant-id"
266276 mock_config .write_text (json .dumps (config_data , indent = 2 ))
267277 config_module ._CONFIG_CACHE = None
268278 config_module ._CONFIG_MTIME = None
279+ config_module ._CONFIG_SIZE = None
269280
270281 result = runner .invoke (app , ["project" , "set-cloud" , "research" ])
271282 assert result .exit_code == 0
272283
273284 # Verify workspace_id was set from default
274285 config_module ._CONFIG_CACHE = None
275286 config_module ._CONFIG_MTIME = None
287+ config_module ._CONFIG_SIZE = None
276288 updated_data = json .loads (mock_config .read_text ())
277289 assert updated_data ["projects" ]["research" ]["workspace_id" ] == "global-default-tenant-id"
0 commit comments