Skip to content

Commit 7d3dd9f

Browse files
author
Dan
committed
Updated setup.py. Py3 compatibility changes for embedded server
1 parent e7791a2 commit 7d3dd9f

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

embedded_server/embedded_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def check_channel_exec_request(self, channel, cmd,
182182
def check_channel_env_request(self, channel, name, value):
183183
if not hasattr(channel, 'environment'):
184184
channel.environment = {}
185-
channel.environment.update({name: value})
185+
channel.environment.update({name.decode('utf8'): value.decode('utf8')})
186186
return True
187187

188188
def _read_response(self, channel, process):

pssh/pssh_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ def _exec_command(self, host, command, sudo=False, user=None,
663663
shell=None, use_shell=True, use_pty=True,
664664
environment=None):
665665
"""Make SSHClient, run command on host"""
666-
if not host in self.host_clients or not self.host_clients[host]:
666+
if host not in self.host_clients or self.host_clients[host] is None:
667667
_user, _port, _password, _pkey = self._get_host_config_values(host)
668668
_user = user if user else _user
669669
self.host_clients[host] = SSHClient(host, user=_user,

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
'Programming Language :: Python :: 3',
4242
'Programming Language :: Python :: 3.4',
4343
'Programming Language :: Python :: 3.5',
44+
'Programming Language :: Python :: 3.6',
4445
'Topic :: Software Development :: Libraries :: Python Modules',
4546
'Operating System :: POSIX :: Linux',
4647
'Operating System :: POSIX :: BSD',

tests/test_pssh_client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def test_pssh_client_ssh_exception(self):
217217
self.assertRaises(SSHException, client.run_command, self.fake_cmd)
218218
del client
219219
server.kill()
220-
220+
221221
def test_pssh_client_timeout(self):
222222
server_timeout=0.2
223223
client_timeout=server_timeout-0.1
@@ -269,7 +269,7 @@ def test_pssh_client_long_running_command_exit_codes(self):
269269
self.assertTrue(output[self.host]['exit_code'] == 0,
270270
msg="Got non-zero exit code %s" % (
271271
output[self.host]['exit_code'],))
272-
272+
273273
def test_pssh_client_retries(self):
274274
"""Test connection error retries"""
275275
listen_port = self.make_random_port()
@@ -287,7 +287,7 @@ def test_pssh_client_retries(self):
287287
"expected %s" % (num_tries, expected_num_tries,))
288288
else:
289289
raise Exception('No ConnectionErrorException')
290-
290+
291291
def test_sftp_exceptions(self):
292292
# Port with no server listening on it on separate ip
293293
host = '127.0.0.3'
@@ -297,7 +297,7 @@ def test_sftp_exceptions(self):
297297
client.pool.join()
298298
for cmd in cmds:
299299
self.assertRaises(ConnectionErrorException, cmd.get)
300-
300+
301301
def test_pssh_copy_file(self):
302302
"""Test parallel copy file"""
303303
test_file_data = 'test'
@@ -319,7 +319,7 @@ def test_pssh_copy_file(self):
319319
os.unlink(filepath)
320320
shutil.rmtree(remote_test_dir)
321321
del client
322-
322+
323323
def test_pssh_client_directory(self):
324324
"""Tests copying multiple directories with SSH client. Copy all the files from
325325
local directory to server, then make sure they are all present."""
@@ -405,7 +405,7 @@ def test_pssh_client_copy_file_failure(self):
405405
os.chmod(remote_test_path, mask)
406406
for path in [local_test_path, remote_test_path]:
407407
shutil.rmtree(path)
408-
408+
409409
def test_pssh_copy_remote_file(self):
410410
"""Test parallel copy file to local host"""
411411
test_file_data = 'test'
@@ -737,7 +737,7 @@ def test_ssh_exception(self):
737737
else:
738738
raise Exception("Expected SSHException")
739739
server.kill()
740-
740+
741741
def test_multiple_single_quotes_in_cmd(self):
742742
"""Test that we can run a command with multiple single quotes"""
743743
output = self.client.run_command("echo 'me' 'and me'")
@@ -751,15 +751,15 @@ def test_multiple_single_quotes_in_cmd(self):
751751
self.assertEqual(expected, stdout[0],
752752
msg="Got unexpected output. Expected %s, got %s" % (
753753
expected, stdout[0],))
754-
754+
755755
def test_backtics_in_cmd(self):
756756
"""Test running command with backtics in it"""
757757
output = self.client.run_command("out=`ls` && echo $out")
758758
self.client.join(output)
759759
self.assertTrue(output[self.host]['exit_code'] == 0,
760760
msg="Error executing cmd with backtics - error code %s" % (
761761
output[self.host]['exit_code'],))
762-
762+
763763
def test_multiple_shell_commands(self):
764764
"""Test running multiple shell commands in one go"""
765765
output = self.client.run_command("echo me; echo and; echo me")
@@ -771,7 +771,7 @@ def test_multiple_shell_commands(self):
771771
self.assertEqual(expected, stdout,
772772
msg="Got unexpected output. Expected %s, got %s" % (
773773
expected, stdout,))
774-
774+
775775
def test_escaped_quotes(self):
776776
"""Test escaped quotes in shell variable are handled correctly"""
777777
output = self.client.run_command('t="--flags=\\"this\\""; echo $t')

0 commit comments

Comments
 (0)