Skip to content

Commit c565a63

Browse files
author
Dan
committed
Cleaned up tests. Added gevent sleep in ssh exception test to avoid deadlock on getting exception from embedded server
1 parent 73b8383 commit c565a63

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tests/test_pssh_client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,6 @@ def test_pssh_copy_file(self):
328328
test_file = open(local_filename, 'w')
329329
test_file.writelines([test_file_data + os.linesep])
330330
test_file.close()
331-
server = start_server({ self.fake_cmd : self.fake_resp },
332-
self.listen_socket)
333331
client = ParallelSSHClient([self.host], port=self.listen_port,
334332
pkey=self.user_key)
335333
cmds = client.copy_file(local_filename, remote_filename)
@@ -341,7 +339,6 @@ def test_pssh_copy_file(self):
341339
for filepath in [local_filename, remote_filename]:
342340
os.unlink(filepath)
343341
del client
344-
server.join()
345342

346343
def test_pssh_client_directory(self):
347344
"""Tests copying directories with SSH client. Copy all the files from
@@ -417,7 +414,6 @@ def test_pssh_hosts_more_than_pool_size(self):
417414
msg="Did not get expected output from all hosts. \
418415
Got %s - expected %s" % (stdout, expected_stdout,))
419416
del client
420-
# server1.kill()
421417
del server2
422418

423419
def test_ssh_proxy(self):
@@ -440,7 +436,7 @@ def test_ssh_proxy(self):
440436
msg="Got unexpected stdout - %s, expected %s" %
441437
(stdout,
442438
expected_stdout,))
443-
# server.kill()
439+
self.server.kill()
444440
proxy_server.kill()
445441

446442
def test_bash_variable_substitution(self):
@@ -537,6 +533,7 @@ def test_ssh_exception(self):
537533
user='fakey', password='fakey',
538534
pkey=paramiko.RSAKey.generate(1024))
539535
output = client.run_command(self.fake_cmd, stop_on_errors=False)
536+
gevent.sleep(.2)
540537
client.pool.join()
541538
self.assertTrue('exception' in output[host],
542539
msg="Got no exception for host %s - expected connection error" % (

0 commit comments

Comments
 (0)