1
1
# -*- coding: utf-8 -*-
2
2
# This file is part of parallel-ssh.
3
3
#
4
- # Copyright (C) 2014-2020 Panos Kittenis
4
+ # Copyright (C) 2014-2021 Panos Kittenis
5
5
#
6
6
# This library is free software; you can redistribute it and/or
7
7
# modify it under the terms of the GNU Lesser General Public
29
29
from datetime import datetime
30
30
from unittest .mock import patch , MagicMock
31
31
32
- from gevent import joinall , spawn , socket , Greenlet , sleep , Timeout as GTimeout
32
+ from gevent import joinall , spawn , socket , sleep , Timeout as GTimeout
33
33
from pssh .config import HostConfig
34
34
from pssh .clients .native import ParallelSSHClient
35
35
from pssh .exceptions import UnknownHostException , \
36
- AuthenticationException , ConnectionErrorException , SessionError , \
36
+ AuthenticationException , ConnectionErrorException , \
37
37
HostArgumentException , SFTPError , SFTPIOError , Timeout , SCPError , \
38
38
PKeyFileError , ShellError , HostArgumentError , NoIPv6AddressFoundError
39
39
from pssh .output import HostOutput
@@ -1042,6 +1042,7 @@ def test_per_host_tuple_args(self):
1042
1042
pkey = self .user_key ,
1043
1043
num_retries = 2 )
1044
1044
output = client .run_command (cmd , host_args = host_args )
1045
+ client .join ()
1045
1046
for i , host in enumerate (hosts ):
1046
1047
expected = [host_args [i ]]
1047
1048
stdout = list (output [i ].stdout )
@@ -1050,6 +1051,7 @@ def test_per_host_tuple_args(self):
1050
1051
host_args = (('arg1' , 'arg2' ), ('arg3' , 'arg4' ), ('arg5' , 'arg6' ),)
1051
1052
cmd = 'echo %s %s'
1052
1053
output = client .run_command (cmd , host_args = host_args )
1054
+ client .join ()
1053
1055
for i , host in enumerate (hosts ):
1054
1056
expected = ["%s %s" % host_args [i ]]
1055
1057
stdout = list (output [i ].stdout )
@@ -1198,14 +1200,6 @@ def test_run_command_sudo(self):
1198
1200
self .assertEqual (len (output ), len (self .client .hosts ))
1199
1201
self .assertTrue (output [0 ].channel is not None )
1200
1202
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
-
1209
1203
def test_conn_failure (self ):
1210
1204
"""Test connection error failure case - ConnectionErrorException"""
1211
1205
client = ParallelSSHClient (['127.0.0.100' ], port = self .port ,
0 commit comments