Skip to content

Commit d754cf9

Browse files
committed
fix: use cross-platform path comparisons in Windows tests
- Use .as_posix() for path comparison (Windows uses backslashes) - Use Path.is_absolute() instead of checking for '/' prefix - Ensures tests pass on Windows, Linux, and macOS Signed-off-by: Claude <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent bc37ecf commit d754cf9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/cli/test_project_add_with_local_path.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for bm project add with --local-path flag."""
22

33
import json
4+
from pathlib import Path
45
from unittest.mock import AsyncMock, patch
56

67
import pytest
@@ -88,7 +89,8 @@ def test_project_add_with_local_path_saves_to_config(
8889
# Verify config was updated
8990
config_data = json.loads(mock_config.read_text())
9091
assert "test-project" in config_data["cloud_projects"]
91-
assert config_data["cloud_projects"]["test-project"]["local_path"] == str(local_sync_dir)
92+
# Use as_posix() for cross-platform compatibility (Windows uses backslashes)
93+
assert config_data["cloud_projects"]["test-project"]["local_path"] == local_sync_dir.as_posix()
9294
assert config_data["cloud_projects"]["test-project"]["last_sync"] is None
9395
assert config_data["cloud_projects"]["test-project"]["bisync_initialized"] is False
9496

@@ -125,7 +127,8 @@ def test_project_add_local_path_expands_tilde(runner, mock_config, mock_api_clie
125127
# Verify config has expanded path
126128
config_data = json.loads(mock_config.read_text())
127129
local_path = config_data["cloud_projects"]["test-project"]["local_path"]
128-
assert local_path.startswith("/")
130+
# Path should be absolute (starts with / on Unix or drive letter on Windows)
131+
assert Path(local_path).is_absolute()
129132
assert "~" not in local_path
130133
assert local_path.endswith("/test-sync")
131134

0 commit comments

Comments
 (0)