55import unittest
66import gevent
77from pssh import ParallelSSHClient , UnknownHostException , \
8- AuthenticationException , ConnectionErrorException
8+ AuthenticationException , ConnectionErrorException , _setup_logger
99from fake_server .fake_server import listen , logger as server_logger
1010import random
1111import logging
1212
13+ _setup_logger (server_logger )
14+
1315class 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