Skip to content

Commit c3fd466

Browse files
Fix macOS test failures by resolving paths in test assertions
The tests were failing on macOS due to symlink resolution differences. macOS has /var symlinked to /private/var, so tempfile.TemporaryDirectory() creates paths like /var/folders/... but ContextOptimizer resolves them to /private/var/folders/... Fixed by calling .resolve() on base_path in the three affected tests before making assertions, ensuring path comparison works correctly across platforms. Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com>
1 parent bb22283 commit c3fd466

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/unit/compilation/test_context_optimizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def test_should_exclude_path_path_outside_base_dir(self):
602602
def test_analyze_project_structure_with_exclusions(self):
603603
"""Test that _analyze_project_structure respects exclusion patterns."""
604604
with tempfile.TemporaryDirectory() as tmpdir:
605-
base_path = Path(tmpdir)
605+
base_path = Path(tmpdir).resolve() # Resolve to handle symlinks (e.g., macOS /var -> /private/var)
606606

607607
# Create directory structure
608608
(base_path / "src").mkdir()
@@ -628,7 +628,7 @@ def test_analyze_project_structure_with_exclusions(self):
628628
def test_analyze_project_structure_with_nested_exclusions(self):
629629
"""Test that nested exclusions work correctly."""
630630
with tempfile.TemporaryDirectory() as tmpdir:
631-
base_path = Path(tmpdir)
631+
base_path = Path(tmpdir).resolve() # Resolve to handle symlinks (e.g., macOS /var -> /private/var)
632632

633633
# Create nested directory structure
634634
(base_path / "projects" / "packages" / "apm" / "src").mkdir(parents=True)
@@ -653,7 +653,7 @@ def test_analyze_project_structure_with_nested_exclusions(self):
653653
def test_default_exclusions_still_work(self):
654654
"""Test that default hardcoded exclusions still work alongside custom patterns."""
655655
with tempfile.TemporaryDirectory() as tmpdir:
656-
base_path = Path(tmpdir)
656+
base_path = Path(tmpdir).resolve() # Resolve to handle symlinks (e.g., macOS /var -> /private/var)
657657

658658
# Create directories including default exclusions
659659
(base_path / "src").mkdir()

0 commit comments

Comments
 (0)