summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-10-16 06:27:27 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-10-16 06:28:46 +0200
commita576ef98aea2709741f32a863cff3c7a54172ded (patch)
tree8c11280275717cc7623a91b91bca16b9f92e59ee
parent803caec60bed3b282b9f9961860a467160c0c8f1 (diff)
[4.2.x] Refs #34900, Refs #34118 -- Updated assertion in test_skip_class_unless_db_feature() test on Python 3.12.1+.
Python 3.12.1+ no longer includes skipped tests in the number of running tests. Check out: https://github.com/python/cpython/issues/110890#issuecomment-1763458686 https://github.com/python/cpython/pull/106588 Backport of 20b7aac7ca60b0352d926340622e618bcbee54a8 from main
-rw-r--r--tests/test_utils/tests.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 823f115be3..b81e6b6c94 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -1,5 +1,6 @@
import logging
import os
+import sys
import unittest
import warnings
from io import StringIO
@@ -182,7 +183,9 @@ class SkippingClassTestCase(TestCase):
except unittest.SkipTest:
self.fail("SkipTest should not be raised here.")
result = unittest.TextTestRunner(stream=StringIO()).run(test_suite)
- self.assertEqual(result.testsRun, 3)
+ # 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)
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__")