Skip to content

Commit 925f4bf

Browse files
committed
Fix SFTP unit test issues on Windows with 8.3 filenames
1 parent 250c9e9 commit 925f4bf

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

asyncssh/sftp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7539,6 +7539,9 @@ def readlink(self, path: bytes) -> MaybeAwait[bytes]:
75397539
path.startswith('\\\\?\\'): # pragma: no cover
75407540
path = path[4:]
75417541

7542+
if self._chroot:
7543+
path = os.path.realpath(path)
7544+
75427545
return self.reverse_map_path(_from_local_path(path))
75437546

75447547
def symlink(self, oldpath: bytes, newpath: bytes) -> MaybeAwait[None]:

tests/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_include(self):
156156
with open('.ssh/include', 'w') as f:
157157
f.write('Port 2222')
158158

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

tests/test_sftp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ def _check_link(self, link, target):
709709
if link.startswith('\\\\?\\'): # pragma: no cover
710710
link = link[4:]
711711

712-
self.assertEqual(link, target)
712+
self.assertEqual(Path(link).resolve(), Path(target).resolve())
713713

714714

715715
class _TestSFTP(_CheckSFTP):

0 commit comments

Comments
 (0)