summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2022-06-03 15:23:14 -0400
committerJeff Forcier <jeff@bitprophet.org>2022-06-03 15:23:14 -0400
commit2ae1ae85eb06bb6bf03e162e1b9441c18d738cc5 (patch)
treed017742a0a353a0a4c19dadd747585316ff6a40a /tests
parenteccdeeb58362a9cad78b94857ee6d258e1e2c893 (diff)
parentc42be15d86e919cebfe4a585d1db97fcaafdbe59 (diff)
downloadparamiko-2ae1ae85eb06bb6bf03e162e1b9441c18d738cc5.tar.gz
Merge branch '2.9' into 2.10
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py9
-rw-r--r--tests/test_sftp.py4
2 files changed, 6 insertions, 7 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index 9850f3c1..f43975d2 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -36,7 +36,7 @@ def requireNonAsciiLocale(category_name="LC_ALL"):
def _decorate_with_locale(category, try_locales, test_method):
"""Decorate test_method to run after switching to a different locale."""
- def _test_under_locale(testself, sftp):
+ def _test_under_locale(testself, *args, **kwargs):
original = locale.setlocale(category)
while try_locales:
try:
@@ -46,12 +46,11 @@ def _decorate_with_locale(category, try_locales, test_method):
try_locales.pop(0)
else:
try:
- return test_method(testself)
+ return test_method(testself, *args, **kwargs)
finally:
locale.setlocale(category, original)
- skipTest = getattr(testself, "skipTest", None)
- if skipTest is not None:
- skipTest("No usable locales installed")
+ # No locales could be used? Just skip the decorated test :(
+ skip("No usable locales installed")
functools.update_wrapper(_test_under_locale, test_method)
return _test_under_locale
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 6134d070..2152d885 100644
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -277,7 +277,7 @@ class TestSFTP(object):
sftp.open(sftp.FOLDER + "/canard.txt", "w").close()
try:
folder_contents = sftp.listdir(sftp.FOLDER)
- self.assertEqual(["canard.txt"], folder_contents)
+ assert ["canard.txt"] == folder_contents
finally:
sftp.remove(sftp.FOLDER + "/canard.txt")
@@ -797,7 +797,7 @@ class TestSFTP(object):
"""Test SFTPAttributes under a locale with non-ascii time strings."""
some_stat = os.stat(sftp.FOLDER)
sftp_attributes = SFTPAttributes.from_stat(some_stat, u("a_directory"))
- self.assertTrue(b"a_directory" in sftp_attributes.asbytes())
+ assert b"a_directory" in sftp_attributes.asbytes()
def test_sftp_attributes_empty_str(self, sftp):
sftp_attributes = SFTPAttributes()