Skip to content

Commit 0503ab0

Browse files
phernandezclaude
andcommitted
fix: Check directory existence before load_config() in test
The test_add_project_never_creates_directory test was checking directory existence after load_config(), but BasicMemoryConfig's model validator ensure_project_paths_exists creates missing directories on deserialization. Move the assertion before load_config() so it verifies add_project() behavior rather than testing the validator side effect. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent e90ce11 commit 0503ab0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,14 @@ def test_add_project_never_creates_directory(self):
601601
nonexistent_path = str(temp_path / "nonexistent" / "project")
602602
config_manager.add_project("test-project", nonexistent_path)
603603

604-
# Verify project was added to config without creating the directory
604+
# Check directory does NOT exist right after add_project(),
605+
# before load_config() which triggers the model validator
606+
assert not Path(nonexistent_path).exists()
607+
608+
# Verify project was persisted in config
605609
config = config_manager.load_config()
606610
assert "test-project" in config.projects
607611
assert config.projects["test-project"].path == nonexistent_path
608-
assert not Path(nonexistent_path).exists()
609612

610613
def test_model_post_init_uses_platform_native_separators(self, config_home, monkeypatch):
611614
"""Test that model_post_init uses platform-native separators."""

0 commit comments

Comments
 (0)