mirror of
				https://github.com/django/django.git
				synced 2025-10-30 00:56:09 +00:00 
			
		
		
		
	[5.0.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 20b7aac7ca from main
			
			
This commit is contained in:
		| @@ -1,4 +1,5 @@ | |||||||
| import os | import os | ||||||
|  | import sys | ||||||
| import unittest | import unittest | ||||||
| import warnings | import warnings | ||||||
| from io import StringIO | from io import StringIO | ||||||
| @@ -182,7 +183,9 @@ class SkippingClassTestCase(TestCase): | |||||||
|         except unittest.SkipTest: |         except unittest.SkipTest: | ||||||
|             self.fail("SkipTest should not be raised here.") |             self.fail("SkipTest should not be raised here.") | ||||||
|         result = unittest.TextTestRunner(stream=StringIO()).run(test_suite) |         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(len(result.skipped), 2) | ||||||
|         self.assertEqual(result.skipped[0][1], "Database has feature(s) __class__") |         self.assertEqual(result.skipped[0][1], "Database has feature(s) __class__") | ||||||
|         self.assertEqual(result.skipped[1][1], "Database has feature(s) __class__") |         self.assertEqual(result.skipped[1][1], "Database has feature(s) __class__") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user