From 1ba5afa0f21f10843bb530b443687e07a511516a Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Fri, 9 Feb 2024 11:49:08 +0100 Subject: [PATCH] [5.0.x] Refs #34900, Refs #34118 -- Updated assertion in test_skip_class_unless_db_feature() test on Python 3.12.2+. Python 3.12.2 bring back the skipped tests in the number of running tests. Refs https://github.com/python/cpython/commit/0a737639dcd3b7181250f5d56694b192eaddeef0 Backport of bc8471f0aac8f0c215b9471b594d159783bac19b from main --- tests/test_utils/tests.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index 963fa2fe0d..d8feda9423 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -183,9 +183,11 @@ class SkippingClassTestCase(TestCase): except unittest.SkipTest: self.fail("SkipTest should not be raised here.") result = unittest.TextTestRunner(stream=StringIO()).run(test_suite) - # PY312: Python 3.12.1+ no longer includes skipped tests in the number - # of running tests. - self.assertEqual(result.testsRun, 1 if sys.version_info >= (3, 12, 1) else 3) + # PY312: Python 3.12.1 does not include skipped tests in the number of + # running tests. + self.assertEqual( + result.testsRun, 1 if sys.version_info[:3] == (3, 12, 1) else 3 + ) self.assertEqual(len(result.skipped), 2) self.assertEqual(result.skipped[0][1], "Database has feature(s) __class__") self.assertEqual(result.skipped[1][1], "Database has feature(s) __class__")