summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2005-01-16 21:03:15 +0000
committerRobey Pointer <robey@lag.net>2005-01-16 21:03:15 +0000
commit3db675d1befe652e58f6c55c9d0633ba97cd5073 (patch)
tree1c9fd998ca37c360b3bb95b7b590e44be96309af /test.py
parentb89025d4097e5d13b1dea90877cc3c166e6e6541 (diff)
downloadparamiko-3db675d1befe652e58f6c55c9d0633ba97cd5073.tar.gz
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-139]
make loopback sftp tests the default change the unit tests to default to always running the sftp tests locally, and make a -R option to force the tests to run against a remote server. the tests seem to work fine locally, and it helps test out server mode, even though there's a danger that they could get isolated from reality and only test that paramiko can talk to itself.
Diffstat (limited to 'test.py')
-rwxr-xr-xtest.py42
1 files changed, 23 insertions, 19 deletions
diff --git a/test.py b/test.py
index ad2f9f51..01e8a0f2 100755
--- a/test.py
+++ b/test.py
@@ -41,38 +41,42 @@ default_keyfile = os.path.join(os.environ.get('HOME', '/'), '.ssh/id_rsa')
default_passwd = None
parser = OptionParser('usage: %prog [options]')
-parser.add_option('--sftp', action='store_true', dest='use_sftp', default=False,
- help='run sftp tests (currently require an external sftp server)')
+parser.add_option('--no-pkey', action='store_false', dest='use_pkey', default=True,
+ help='skip RSA/DSS private key tests (which can take a while)')
+parser.add_option('--no-transport', action='store_false', dest='use_transport', default=True,
+ help='skip transport tests (which can take a while)')
+parser.add_option('--no-sftp', action='store_false', dest='use_sftp', default=True,
+ help='skip SFTP client/server tests, which can be slow')
+parser.add_option('--no-big-file', action='store_false', dest='use_big_file', default=True,
+ help='skip big file SFTP tests, which are slow as molasses')
+parser.add_option('-R', action='store_false', dest='use_loopback_sftp', default=True,
+ help='perform SFTP tests against a remote server (by default, SFTP tests ' +
+ 'are done through a loopback socket)')
parser.add_option('-H', '--sftp-host', dest='hostname', type='string', default=default_host,
metavar='<host>',
- help='remote host for sftp tests (default: %s)' % default_host)
+ help='[with -R] host for remote sftp tests (default: %s)' % default_host)
parser.add_option('-U', '--sftp-user', dest='username', type='string', default=default_user,
metavar='<username>',
- help='username for sftp tests (default: %s)' % default_user)
+ help='[with -R] username for remote sftp tests (default: %s)' % default_user)
parser.add_option('-K', '--sftp-key', dest='keyfile', type='string', default=default_keyfile,
metavar='<keyfile>',
- help='location of private key for sftp tests (default: %s)' % default_keyfile)
+ help='[with -R] location of private key for remote sftp tests (default: %s)' %
+ default_keyfile)
parser.add_option('-P', '--sftp-passwd', dest='password', type='string', default=default_passwd,
metavar='<password>',
- help='(optional) password to unlock the private key for sftp tests')
-parser.add_option('--no-pkey', action='store_false', dest='use_pkey', default=True,
- help='skip RSA/DSS private key tests (which can take a while)')
-parser.add_option('--no-transport', action='store_false', dest='use_transport', default=True,
- help='skip transport tests (which can take a while)')
-parser.add_option('--no-big-file', action='store_false', dest='use_big_file', default=True,
- help='skip big file SFTP tests, which are slow as molasses')
-parser.add_option('-X', action='store_true', dest='use_loopback_sftp', default=False)
+ help='[with -R] (optional) password to unlock the private key for remote sftp tests')
options, args = parser.parse_args()
if len(args) > 0:
parser.error('unknown argument(s)')
if options.use_sftp:
- SFTPTest.init(options.hostname, options.username, options.keyfile, options.password)
-if options.use_loopback_sftp:
- SFTPTest.init_loopback()
-if not options.use_big_file:
- SFTPTest.set_big_file_test(False)
+ if options.use_loopback_sftp:
+ SFTPTest.init_loopback()
+ else:
+ SFTPTest.init(options.hostname, options.username, options.keyfile, options.password)
+ if not options.use_big_file:
+ SFTPTest.set_big_file_test(False)
# setup logging
paramiko.util.log_to_file('test.log')
@@ -85,6 +89,6 @@ if options.use_pkey:
suite.addTest(unittest.makeSuite(KexTest))
if options.use_transport:
suite.addTest(unittest.makeSuite(TransportTest))
-if options.use_sftp or options.use_loopback_sftp:
+if options.use_sftp:
suite.addTest(unittest.makeSuite(SFTPTest))
unittest.TextTestRunner(verbosity=2).run(suite)