Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Addresses review feedback requesting test coverage for PathAccessor and FilesystemPath to prevent regressions in filesystem behavior changes.

Changes

  • New test file tests/unit/test_filesystem.py with 23 tests covering:

    • PathAccessor.stat() returning None on OSError (nonexistent paths, permission errors)
    • PathAccessor.keys() returning entry names not full paths
    • Symlink handling via lstat() on Python <3.10 and stat(follow_symlinks=False) on ≥3.10
    • FilesystemPath.exists() behavior delegating to stat() result
  • Test assertions verify:

    • keys() returns ["file.txt"] not ["/full/path/file.txt"]
    • stat() on symlinks returns symlink's own stat (size ≠ target size)
    • exists() returns False when stat() raises OSError

Example

# Before: No tests verified this behavior
accessor = PathAccessor(tmp_path)
result = accessor.stat(["nonexistent.txt"])
assert result is None  # Now tested

# keys() returns names, not paths
result = accessor.keys([])
assert result == ["test.txt"]  # Not ["/tmp/xyz/test.txt"]

Coverage improved from 48% to 87%. Added reports/ to .gitignore to exclude test artifacts.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 11, 2026 17:30
Co-authored-by: p1c2u <1679024+p1c2u@users.noreply.github.com>
Co-authored-by: p1c2u <1679024+p1c2u@users.noreply.github.com>
Co-authored-by: p1c2u <1679024+p1c2u@users.noreply.github.com>
Co-authored-by: p1c2u <1679024+p1c2u@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix OSError handling improvements for PathAccessor Add test coverage for PathAccessor and FilesystemPath OSError handling Feb 11, 2026
Copilot AI requested a review from p1c2u February 11, 2026 17:35
@p1c2u p1c2u marked this pull request as ready for review February 11, 2026 17:36
@p1c2u p1c2u merged commit 683ca7b into fix/filesystempath-stat-catch-oserror Feb 11, 2026
10 checks passed
@p1c2u p1c2u deleted the copilot/sub-pr-69 branch February 11, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants