Skip to content

Commit

Permalink
Fix SFTP unit test issues on Windows with 8.3 filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
ronf committed Dec 27, 2024
1 parent 250c9e9 commit 925f4bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions asyncssh/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7539,6 +7539,9 @@ def readlink(self, path: bytes) -> MaybeAwait[bytes]:
path.startswith('\\\\?\\'): # pragma: no cover
path = path[4:]

if self._chroot:
path = os.path.realpath(path)

return self.reverse_map_path(_from_local_path(path))

def symlink(self, oldpath: bytes, newpath: bytes) -> MaybeAwait[None]:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_include(self):
with open('.ssh/include', 'w') as f:
f.write('Port 2222')

for path in ('include', Path('.ssh/include').absolute().as_posix()):
for path in ('include', Path('.ssh/include').resolve().as_posix()):
config = self._parse_config(f'Include {path}')
self.assertEqual(config.get('Port'), 2222)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def _check_link(self, link, target):
if link.startswith('\\\\?\\'): # pragma: no cover
link = link[4:]

self.assertEqual(link, target)
self.assertEqual(Path(link).resolve(), Path(target).resolve())


class _TestSFTP(_CheckSFTP):
Expand Down

0 comments on commit 925f4bf

Please sign in to comment.