11# -*- coding: utf-8 -*-
22# This file is part of parallel-ssh.
33#
4- # Copyright (C) 2014-2020 Panos Kittenis
4+ # Copyright (C) 2014-2021 Panos Kittenis
55#
66# This library is free software; you can redistribute it and/or
77# modify it under the terms of the GNU Lesser General Public
2929from datetime import datetime
3030from unittest .mock import patch , MagicMock
3131
32- from gevent import joinall , spawn , socket , Greenlet , sleep , Timeout as GTimeout
32+ from gevent import joinall , spawn , socket , sleep , Timeout as GTimeout
3333from pssh .config import HostConfig
3434from pssh .clients .native import ParallelSSHClient
3535from pssh .exceptions import UnknownHostException , \
36- AuthenticationException , ConnectionErrorException , SessionError , \
36+ AuthenticationException , ConnectionErrorException , \
3737 HostArgumentException , SFTPError , SFTPIOError , Timeout , SCPError , \
3838 PKeyFileError , ShellError , HostArgumentError , NoIPv6AddressFoundError
3939from pssh .output import HostOutput
@@ -1042,6 +1042,7 @@ def test_per_host_tuple_args(self):
10421042 pkey = self .user_key ,
10431043 num_retries = 2 )
10441044 output = client .run_command (cmd , host_args = host_args )
1045+ client .join ()
10451046 for i , host in enumerate (hosts ):
10461047 expected = [host_args [i ]]
10471048 stdout = list (output [i ].stdout )
@@ -1050,6 +1051,7 @@ def test_per_host_tuple_args(self):
10501051 host_args = (('arg1' , 'arg2' ), ('arg3' , 'arg4' ), ('arg5' , 'arg6' ),)
10511052 cmd = 'echo %s %s'
10521053 output = client .run_command (cmd , host_args = host_args )
1054+ client .join ()
10531055 for i , host in enumerate (hosts ):
10541056 expected = ["%s %s" % host_args [i ]]
10551057 stdout = list (output [i ].stdout )
@@ -1198,14 +1200,6 @@ def test_run_command_sudo(self):
11981200 self .assertEqual (len (output ), len (self .client .hosts ))
11991201 self .assertTrue (output [0 ].channel is not None )
12001202
1201- @unittest .skipUnless (bool (os .getenv ('TRAVIS' )), "Not on Travis CI - skipping" )
1202- def test_run_command_sudo_var (self ):
1203- command = """for i in 1 2 3; do echo $i; done"""
1204- output = list (self .client .run_command (
1205- command , sudo = True )[0 ].stdout )
1206- expected = ['1' ,'2' ,'3' ]
1207- self .assertListEqual (output , expected )
1208-
12091203 def test_conn_failure (self ):
12101204 """Test connection error failure case - ConnectionErrorException"""
12111205 client = ParallelSSHClient (['127.0.0.100' ], port = self .port ,
0 commit comments