diff options
author | Pierce Lopez <pierce.lopez@gmail.com> | 2017-06-06 18:13:30 -0400 |
---|---|---|
committer | Pierce Lopez <pierce.lopez@gmail.com> | 2017-06-07 00:38:04 -0400 |
commit | 500e2641981f504a7a9a744305935360f5973222 (patch) | |
tree | e6b7af541bf675784fd0e429a4eadaef4e1167dc /tests/test_auth.py | |
parent | ddb277d4e4989e914b67ff26c14c7c298e7fab9f (diff) | |
download | paramiko-500e2641981f504a7a9a744305935360f5973222.tar.gz |
cleanup/simplify auth_timeout tests
Diffstat (limited to 'tests/test_auth.py')
-rw-r--r-- | tests/test_auth.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py index 58b2f44f..e78397c6 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -243,18 +243,12 @@ class AuthTest (unittest.TestCase): verify that authentication times out if server takes to long to respond (or never responds). """ - auth_timeout = self.tc.auth_timeout - self.tc.auth_timeout = 2 # Reduce to 2 seconds to speed up test - + self.tc.auth_timeout = 1 # 1 second, to speed up test + self.start_server() + self.tc.connect() try: - self.start_server() - self.tc.connect() - try: - remain = self.tc.auth_password('unresponsive-server', 'hello') - except: - etype, evalue, etb = sys.exc_info() - self.assertTrue(issubclass(etype, AuthenticationException)) - self.assertTrue('Authentication timeout' in str(evalue)) - finally: - # Restore value - self.tc.auth_timeout = auth_timeout + remain = self.tc.auth_password('unresponsive-server', 'hello') + except: + etype, evalue, etb = sys.exc_info() + self.assertTrue(issubclass(etype, AuthenticationException)) + self.assertTrue('Authentication timeout' in str(evalue)) |