From af664ad316b23592e9cec429c03d593d8cbd0ed6 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 3 Jun 2022 14:50:21 -0400 Subject: Streamline default test name on Circle --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b622057..86f3d23d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,7 +53,7 @@ workflows: name: Style check # Main test run, w/ coverage, and latest-supported cryptography - orb/coverage: - name: Test 3.6 (w/ coverage, latest crypto) + name: Test # Non-coverage runs w/ other crypto versions. # (Phrased as 2-dimensional matrix but 3.6 only for now to save credits) - orb/test: @@ -75,12 +75,12 @@ workflows: - sdist-test-suite: name: Test within sdist requires: - - "Test 3.6 (w/ coverage, latest crypto)" + - "Test" - "Release test" # Test other interpreters if main passed - orb/test: name: Test << matrix.version >> - requires: ["Test 3.6 (w/ coverage, latest crypto)"] + requires: ["Test"] matrix: parameters: version: ["3.7", "3.8", "3.9"] @@ -88,4 +88,4 @@ workflows: # all those credits if the main tests would also fail...) - orb/docs: name: "Docs" - requires: ["Test 3.6 (w/ coverage, latest crypto)"] + requires: ["Test"] -- cgit v1.2.1 From 47cfed55575c21ac558e6d00a4ab1814406be651 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Thu, 2 Dec 2021 17:11:29 +0300 Subject: sftp tests: Replace unittest parts The original PR https://github.com/paramiko/paramiko/pull/992 introduced several tests for sftp functionality. These tests made use of unittest's stuff like `assertTrue` and `assertEqual` because at that moment the tests were grouped under the `unittest.TestCase`-based class (`SFTPTest`). Before PR merge `unittest.TestCase` was refactored out from sftp tests (667bd74b139ed86f9b261d3abf5b6042ba80920b) but PR was not updated. The sftp tests are marked with `slow` and that's why they are not failed in CI (slow tests are excluded by default). Fixes: https://github.com/paramiko/paramiko/issues/1941 Signed-off-by: Stanislav Levin --- 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 9850f3c1..2a9cb4b9 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 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() -- cgit v1.2.1 From 7c54625f8fc21d8381ecb4a1af74f2db5da96da1 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 3 Jun 2022 15:12:19 -0400 Subject: Fix broken unittesty skipTest in locale decorator --- tests/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 2a9cb4b9..f43975d2 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -49,9 +49,8 @@ def _decorate_with_locale(category, try_locales, test_method): 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 -- cgit v1.2.1