Skip to content

Commit 97184b0

Browse files
author
Pan
committed
Moved realpath failure to its own test
1 parent faa948c commit 97184b0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/test_ssh2.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,17 @@ def test_sftp_setstat(self):
270270
finally:
271271
os.unlink(remote_filename)
272272

273+
def test_realpath_failure(self):
274+
self.assertEqual(self._auth(), 0)
275+
sftp = self.session.sftp_init()
276+
self.assertTrue(sftp is not None)
277+
# Depends on library version which error is returned
278+
try:
279+
self.assertRaises(SFTPBufferTooSmall,
280+
sftp.realpath, 'fake path', max_len=1)
281+
except SFTPHandleError:
282+
pass
283+
273284
def test_sftp_symlink_realpath_lstat(self):
274285
self.assertEqual(self._auth(), 0)
275286
sftp = self.session.sftp_init()
@@ -281,8 +292,6 @@ def test_sftp_symlink_realpath_lstat(self):
281292
fh.write(test_data)
282293
symlink_target = os.sep.join([os.path.dirname(__file__),
283294
'remote_symlink'])
284-
self.assertRaises(SFTPBufferTooSmall,
285-
sftp.realpath, symlink_target, max_len=1)
286295
try:
287296
self.assertEqual(sftp.symlink(remote_filename, symlink_target), 0)
288297
lstat = sftp.lstat(symlink_target)

0 commit comments

Comments
 (0)