test: make diary state path assertion platform-neutral
The Windows CI job failed on:
assert '/.mempalace/state/' in str(state_path)
because Windows uses ``\`` as the path separator, so the substring
never matches. The behavior under test (state file lives outside the
diary dir, under ``~/.mempalace/state/``) is already correct on both
platforms — only the assertion was Unix-only.
Switch to ``state_path.parent`` comparisons that work on any OS.
This commit is contained in:
@@ -586,7 +586,10 @@ class TestDiaryIngest:
|
|||||||
# State file does exist under ~/.mempalace/state/.
|
# State file does exist under ~/.mempalace/state/.
|
||||||
state_path = _state_file_for(str(palace_dir), diary_dir.resolve())
|
state_path = _state_file_for(str(palace_dir), diary_dir.resolve())
|
||||||
assert state_path.exists()
|
assert state_path.exists()
|
||||||
assert "/.mempalace/state/" in str(state_path)
|
# Platform-neutral path check: compare parents rather than a hardcoded
|
||||||
|
# separator string that would fail on Windows (``\.mempalace\state\``).
|
||||||
|
assert state_path.parent.name == "state"
|
||||||
|
assert state_path.parent.parent.name == ".mempalace"
|
||||||
|
|
||||||
def test_wing_prefixed_drawer_id_prevents_cross_diary_collision(self, tmp_path):
|
def test_wing_prefixed_drawer_id_prevents_cross_diary_collision(self, tmp_path):
|
||||||
# Regression: the original implementation used
|
# Regression: the original implementation used
|
||||||
|
|||||||
Reference in New Issue
Block a user