diff options
Diffstat (limited to 'tests/test_sftp.py')
-rwxr-xr-x | tests/test_sftp.py | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 432d3e40..a38c2e7d 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -32,6 +32,8 @@ import warnings from binascii import hexlify from tempfile import mkstemp +import pytest + import paramiko import paramiko.util from paramiko.py3compat import PY2, b, u, StringIO @@ -40,7 +42,6 @@ from paramiko.sftp_attr import SFTPAttributes from .util import needs_builtin from .stub_sftp import StubServer, StubSFTPServer -from .loop import LoopSocket from .util import _support @@ -94,37 +95,7 @@ unicode_folder = eval(compile(r"u'\u00fcnic\u00f8de'" if PY2 else r"'\u00fcnic\u utf8_folder = b'/\xc3\xbcnic\xc3\xb8\x64\x65' -# TODO: turn into a pytest fixture; consider making it module or session-global -# to mimic old behavior (though that still feels unclean to me...) -def make_loopback_sftp(): - """ - Set up an in-memory SFTP server. - - :returns: - A 2-tuple of the resulting SFTPClient (for tests that just care about a - 'default' client) and Transport (for testing instantiation _of_ - SFTPClient itself, which can take an existing transport object.) - """ - socks = LoopSocket() - sockc = LoopSocket() - sockc.link(socks) - tc = paramiko.Transport(sockc) - ts = paramiko.Transport(socks) - - host_key = paramiko.RSAKey.from_private_key_file(_support('test_rsa.key')) - ts.add_server_key(host_key) - event = threading.Event() - server = StubServer() - ts.set_subsystem_handler('sftp', paramiko.SFTPServer, StubSFTPServer) - ts.start_server(event, server) - tc.connect(username='slowdive', password='pygmalion') - event.wait(1.0) - - return paramiko.SFTP.from_transport(tc), tc - - -class SFTPTest (unittest.TestCase): - +class SFTPTest(unittest.TestCase): @staticmethod def set_big_file_test(onoff): global g_big_file_test |