Skip to content

Commit 1a03ae1

Browse files
author
Dan
committed
Updated travis config to correctly run py3 tests. Updated requirements to avoid broken paramiko version on py3. Updated ssh client and embedded server to be py3 compatible.
1 parent a626243 commit 1a03ae1

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ python:
99
install:
1010
- pip install -r requirements.txt
1111
- pip install coveralls
12-
script: python setup.py nosetests --with-coverage --cover-package=pssh
12+
script:
13+
- python setup.py nosetests --with-coverage --cover-package=pssh
14+
# If using py3, run 2to3 on embedded server and tests and run nosetests for new test dir
15+
- python -c 'import sys; sys.version_info.major==3 and sys.exit(1)' || 2to3 -nw embedded_server/*.py && 2to3 tests/*.py -o tests3 -nw && cp tests/test_client_private_key tests3/ && python setup.py nosetests -w tests3 --with-coverage --cover-package=pssh
1316
notifications:
1417
email:
1518
on_failure: change

embedded_server/embedded_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
paramiko repository
2626
"""
2727

28+
import sys
29+
if 'threading' in sys.modules:
30+
del sys.modules['threading']
2831
import gevent
2932
import os
3033
import socket
@@ -106,7 +109,7 @@ def check_channel_exec_request(self, channel, cmd):
106109

107110
def _read_response(self, channel, process):
108111
for line in process.stdout:
109-
channel.send(line)
112+
channel.send(line.decode('ascii'))
110113
process.communicate()
111114
channel.send_exit_status(process.returncode)
112115
logger.debug("Command finished with return code %s", process.returncode)

pssh/ssh_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def exec_command(self, command, sudo=False, user=None, **kwargs):
237237
def _read_output_buffer(self, output_buffer, prefix=''):
238238
"""Read from output buffers and log to host_logger"""
239239
for line in output_buffer:
240-
output = line.strip()
240+
output = line.strip().decode('ascii')
241241
host_logger.info("[%s]%s\t%s", self.host, prefix, output,)
242242
yield output
243243

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
paramiko>=1.9
1+
paramiko>=1.9,<1.16.0
22
gevent>=1.1rc3

0 commit comments

Comments
 (0)