Skip to content

Commit 989f76b

Browse files
committed
Change to join with timeout, add logging
1 parent 8b4155c commit 989f76b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_pssh_client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
import unittest
66
import gevent
77
from pssh import ParallelSSHClient, UnknownHostException, \
8-
AuthenticationException, ConnectionErrorException
8+
AuthenticationException, ConnectionErrorException, _setup_logger
99
from fake_server.fake_server import listen, logger as server_logger
1010
import random
1111
import logging
1212

13+
_setup_logger(server_logger)
14+
1315
class ParallelSSHClientTest(unittest.TestCase):
1416

1517
def setUp(self):
@@ -19,7 +21,7 @@ def setUp(self):
1921
def test_pssh_client_exec_command(self):
2022
listen_port = random.randint(1026, 65534)
2123
server = gevent.spawn(listen, { self.fake_cmd : self.fake_resp }, listen_port = listen_port)
22-
gevent.sleep(1)
24+
server.join(5)
2325
client = ParallelSSHClient(['localhost'], port=listen_port)
2426
cmd = client.exec_command(self.fake_cmd)[0]
2527
output = client.get_stdout(cmd)
@@ -33,7 +35,7 @@ def test_pssh_client_auth_failure(self):
3335
listen_port = random.randint(2048, 65534)
3436
server = gevent.spawn(listen, { self.fake_cmd : self.fake_resp },
3537
listen_port=listen_port, fail_auth=True, )# link_callback=)
36-
gevent.sleep(1)
38+
server.join(5)
3739
client = ParallelSSHClient(['localhost'], port=listen_port)
3840
cmd = client.exec_command(self.fake_cmd)[0]
3941
# Handle exception

0 commit comments

Comments
 (0)