!36 fix error in sftp testcase
From: @chengyechun Reviewed-by: @caodongxia Signed-off-by: @caodongxia
This commit is contained in:
commit
6ac495c127
60
backport-fix-error-in-sftp-testcase.patch
Normal file
60
backport-fix-error-in-sftp-testcase.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
From 47cfed55575c21ac558e6d00a4ab1814406be651 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stanislav Levin <slev@altlinux.org>
|
||||||
|
Date: Sat, 4 Jun 2022 03:03:23 GMT+8
|
||||||
|
Subject: [PATCH] fix error in sftp testcase
|
||||||
|
|
||||||
|
Conflict:NA
|
||||||
|
Reference:https://github.com/paramiko/paramiko/commit/47cfed55575c21ac558e6d00a4ab1814406be651
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/__init__.py | 4 ++--
|
||||||
|
tests/test_sftp.py | 4 ++--
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/__init__.py b/tests/__init__.py
|
||||||
|
index 9850f3c..2a9cb4b 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,7 +46,7 @@ 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)
|
||||||
|
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
|
||||||
|
index 0650e8d..b53ece7 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()
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: python-paramiko
|
Name: python-paramiko
|
||||||
Version: 2.11.0
|
Version: 2.11.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Python SSH module
|
Summary: Python SSH module
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: https://github.com/paramiko/paramiko
|
URL: https://github.com/paramiko/paramiko
|
||||||
@ -10,6 +10,7 @@ Source0: https://github.com/paramiko/paramiko/archive/%{version}/paramiko-
|
|||||||
# Can be removed when https://github.com/paramiko/paramiko/pull/1667/ is released
|
# Can be removed when https://github.com/paramiko/paramiko/pull/1667/ is released
|
||||||
Patch6000: backport-Skip-tests-requiring-invoke.patch
|
Patch6000: backport-Skip-tests-requiring-invoke.patch
|
||||||
Patch6001: 0003-remove-pytest-relaxed-dep.patch
|
Patch6001: 0003-remove-pytest-relaxed-dep.patch
|
||||||
|
Patch6002: backport-fix-error-in-sftp-testcase.patch
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
@ -57,7 +58,6 @@ sphinx-build -b html sites/docs/ html/
|
|||||||
rm -f html/.buildinfo
|
rm -f html/.buildinfo
|
||||||
|
|
||||||
%check
|
%check
|
||||||
rm -f tests/test_sftp*.py
|
|
||||||
PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-%{python3_version}
|
PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-%{python3_version}
|
||||||
|
|
||||||
%files -n python3-paramiko
|
%files -n python3-paramiko
|
||||||
@ -69,6 +69,12 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-%{python3_version}
|
|||||||
%doc html/ demos/ NEWS README.rst
|
%doc html/ demos/ NEWS README.rst
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 31 2022 chengyechun <chengyechun1@huawei.com> - 2.11.0-2
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:fix error in sftp testcase
|
||||||
|
|
||||||
* Thu Jun 23 2022 houyingchao <houyingchao@h-partners.com> - 2.11.0-1
|
* Thu Jun 23 2022 houyingchao <houyingchao@h-partners.com> - 2.11.0-1
|
||||||
- Upgrade to version 2.11.0
|
- Upgrade to version 2.11.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user