From 5ffb1da69bed3dc7f19fc9a7d7dfa7f90fd41924 Mon Sep 17 00:00:00 2001 From: Sheng Date: Mon, 27 Feb 2023 22:13:24 +0800 Subject: [PATCH] Drop support for Python version below 3.8 --- .travis.yml | 8 +------- requirements.txt | 5 ++--- tests/sshserver.py | 8 ++++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0418b01..1481971 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,12 @@ dist: xenial language: python python: - - "2.7" - - "3.4" - - "3.5" - - "3.6" - - "3.7" - "3.8" - "3.9" install: - pip install -r requirements.txt - - pip install 'pytest>=4.6' pytest-cov codecov flake8 - - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install mock; fi + - pip install pytest pytest-cov codecov flake8 script: - pytest --cov=webssh diff --git a/requirements.txt b/requirements.txt index ff0d359..18ee6b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -paramiko==2.10.4 -tornado==5.1.1; python_version < '3.5' -tornado==6.1.0; python_version >= '3.5' +paramiko==3.0.0 +tornado==6.2.0 diff --git a/tests/sshserver.py b/tests/sshserver.py index c322407..1385a98 100644 --- a/tests/sshserver.py +++ b/tests/sshserver.py @@ -1,3 +1,4 @@ +import base64 import random import socket # import sys @@ -6,7 +7,6 @@ import threading import paramiko from binascii import hexlify -from paramiko.py3compat import u, decodebytes from tests.utils import make_tests_data_path @@ -16,7 +16,7 @@ paramiko.util.log_to_file(make_tests_data_path('sshserver.log')) host_key = paramiko.RSAKey(filename=make_tests_data_path('test_rsa.key')) # host_key = paramiko.DSSKey(filename='test_dss.key') -print('Read key: ' + u(hexlify(host_key.get_fingerprint()))) +print('Read key: ' + hexlify(host_key.get_fingerprint()).decode('utf-8')) banner = u'\r\n\u6b22\u8fce\r\n' event_timeout = 5 @@ -29,7 +29,7 @@ class Server(paramiko.ServerInterface): b'fAu7jJ2d7eothvfeuoRFtJwhUmZDluRdFyhFY/hFAh76PJKGAusIqIQKlkJxMC' b'KDqIexkgHAfID/6mqvmnSJf0b5W8v5h2pI/stOSwTQ+pxVhwJ9ctYDhRSlF0iT' b'UWT10hcuO4Ks8=') - good_pub_key = paramiko.RSAKey(data=decodebytes(data)) + good_pub_key = paramiko.RSAKey(data=base64.decodebytes(data)) commands = [ b'$SHELL -ilc "locale charmap"', @@ -62,7 +62,7 @@ class Server(paramiko.ServerInterface): return paramiko.AUTH_FAILED def check_auth_publickey(self, username, key): - print('Auth attempt with username: {!r} & key: {!r}'.format(username, u(hexlify(key.get_fingerprint())))) # noqa + print('Auth attempt with username: {!r} & key: {!r}'.format(username, hexlify(key.get_fingerprint()).decode('utf-8'))) # noqa if (username in ['robey', 'keyonly']) and (key == self.good_pub_key): return paramiko.AUTH_SUCCESSFUL if username == 'pkey2fa' and key == self.good_pub_key: