@@ -111,23 +111,12 @@ def test_ssh_client_conn_failure(self):
111
111
pkey = self .user_key , num_retries = 0 )
112
112
113
113
def test_ssh_client_retries (self ):
114
- """Test connection error retries"""
115
- expected_num_tries = 2
116
- with self .assertRaises (ConnectionErrorException ) as cm :
117
- SSHClient ('127.0.0.1' , port = self .listen_port ,
118
- pkey = self .user_key , num_retries = expected_num_tries )
119
- num_tries = cm .exception .args [- 1 :][0 ]
120
- self .assertEqual (expected_num_tries , num_tries ,
121
- msg = "Got unexpected number of retries %s - expected %s"
122
- % (num_tries , expected_num_tries ,))
114
+ """Test connection error exceptions"""
115
+ self .assertRaises (ConnectionErrorException , SSHClient , '127.0.0.1' , port = self .listen_port ,
116
+ pkey = self .user_key , num_retries = 1 )
123
117
host = '' .join ([random .choice (string .ascii_letters ) for n in xrange (8 )])
124
- with self .assertRaises (UnknownHostException ) as cm :
125
- SSHClient (host , port = self .listen_port ,
126
- pkey = self .user_key , num_retries = expected_num_tries )
127
- num_tries = cm .exception .args [- 1 :][0 ]
128
- self .assertEqual (expected_num_tries , num_tries ,
129
- msg = "Got unexpected number of retries %s - expected %s"
130
- % (num_tries , expected_num_tries ,))
118
+ self .assertRaises (UnknownHostException , SSHClient , host , port = self .listen_port ,
119
+ pkey = self .user_key , num_retries = 1 )
131
120
132
121
def test_ssh_client_unknown_host_failure (self ):
133
122
"""Test connection error failure case - ConnectionErrorException"""
0 commit comments