summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-01-09 21:29:04 -0500
committerJeff Forcier <jeff@bitprophet.org>2023-01-09 23:26:00 -0500
commit74eae059e2ae71044e31a580bc4ede1057c0053b (patch)
tree8c26afc3ce0c0c6494352791fd79b59ad222fb7f /tests
parent4495c4054233c5f7b3c4ffb3fb52ca525bc0d983 (diff)
downloadparamiko-74eae059e2ae71044e31a580bc4ede1057c0053b.tar.gz
Remove py3compat.PY2, including related streamlining
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pkey.py7
-rw-r--r--tests/test_sftp.py2
-rw-r--r--tests/util.py11
3 files changed, 8 insertions, 12 deletions
diff --git a/tests/test_pkey.py b/tests/test_pkey.py
index 45d1ee96..1ed021f9 100644
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -37,7 +37,7 @@ from paramiko import (
util,
SSHException,
)
-from paramiko.py3compat import b, bytes, PY2
+from paramiko.py3compat import b, bytes
from paramiko.common import o600, byte_chr
from cryptography.exceptions import UnsupportedAlgorithm
@@ -134,8 +134,7 @@ L4QLcT5aND0EHZLB2fAUDXiWIb2j4rg1mwPlBMiBXA==
x1234 = b"\x01\x02\x03\x04"
-TEST_KEY_BYTESTR_2 = "\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01#\x00\x00\x00\x81\x00\xd3\x8fV\xea\x07\x85\xa6k%\x8d<\x1f\xbc\x8dT\x98\xa5\x96$\xf3E#\xbe>\xbc\xd2\x93\x93\x87f\xceD\x18\xdb \x0c\xb3\xa1a\x96\xf8e#\xcc\xacS\x8a#\xefVlE\x83\x1epv\xc1o\x17M\xef\xdf\x89DUXL\xa6\x8b\xaa<\x06\x10\xd7\x93w\xec\xaf\xe2\xaf\x95\xd8\xfb\xd9\xbfw\xcb\x9f0)#y{\x10\x90\xaa\x85l\tPru\x8c\t\x19\xce\xa0\xf1\xd2\xdc\x8e/\x8b\xa8f\x9c0\xdey\x84\xd2F\xf7\xcbmm\x1f\x87" # noqa
-TEST_KEY_BYTESTR_3 = "\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01#\x00\x00\x00\x00ӏV\x07k%<\x1fT$E#>ғfD\x18 \x0cae#̬S#VlE\x1epvo\x17M߉DUXL<\x06\x10דw\u2bd5ٿw˟0)#y{\x10l\tPru\t\x19Π\u070e/f0yFmm\x1f" # noqa
+TEST_KEY_BYTESTR = "\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01#\x00\x00\x00\x00ӏV\x07k%<\x1fT$E#>ғfD\x18 \x0cae#̬S#VlE\x1epvo\x17M߉DUXL<\x06\x10דw\u2bd5ٿw˟0)#y{\x10l\tPru\t\x19Π\u070e/f0yFmm\x1f" # noqa
class KeyTest(unittest.TestCase):
@@ -571,7 +570,7 @@ class KeyTest(unittest.TestCase):
def test_stringification(self):
key = RSAKey.from_private_key_file(_support("test_rsa.key"))
- comparable = TEST_KEY_BYTESTR_2 if PY2 else TEST_KEY_BYTESTR_3
+ comparable = TEST_KEY_BYTESTR
self.assertEqual(str(key), comparable)
def test_ed25519(self):
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 98292d26..c273feaa 100644
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -87,7 +87,7 @@ decreased compared with chicken.
# byte"
NON_UTF8_DATA = b"\xC3\xC3"
-unicode_folder = u"\u00fcnic\u00f8de" if PY2 else "\u00fcnic\u00f8de"
+unicode_folder = "\u00fcnic\u00f8de"
utf8_folder = b"/\xc3\xbcnic\xc3\xb8\x64\x65"
diff --git a/tests/util.py b/tests/util.py
index 3ec5d092..951b86ce 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -6,7 +6,7 @@ import unittest
import pytest
-from paramiko.py3compat import builtins, PY2
+from paramiko.py3compat import builtins
from paramiko.ssh_gss import GSS_AUTH_AVAILABLE
from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
@@ -142,12 +142,9 @@ def is_low_entropy():
the hash seed set to zero under Python 3.
"""
is_32bit = struct.calcsize("P") == 32 / 8
- if PY2:
- return is_32bit
- else:
- # I don't see a way to tell internally if the hash seed was set this
- # way, but env should be plenty sufficient, this is only for testing.
- return is_32bit and os.environ.get("PYTHONHASHSEED", None) == "0"
+ # I don't see a way to tell internally if the hash seed was set this
+ # way, but env should be plenty sufficient, this is only for testing.
+ return is_32bit and os.environ.get("PYTHONHASHSEED", None) == "0"
def sha1_signing_unsupported():