mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #27214 -- Made skip db features decorators respect wrapping order and inheritance.
This commit is contained in:
parent
0627858ada
commit
18c72d59e0
2 changed files with 32 additions and 7 deletions
|
@ -106,20 +106,28 @@ class SkippingClassTestCase(SimpleTestCase):
|
|||
def test_dummy(self):
|
||||
return
|
||||
|
||||
@skipUnlessDBFeature("missing")
|
||||
@skipIfDBFeature("__class__")
|
||||
class SkippedTests(unittest.TestCase):
|
||||
def test_will_be_skipped(self):
|
||||
self.fail("We should never arrive here.")
|
||||
|
||||
@skipIfDBFeature("__dict__")
|
||||
class SkippedTestsSubclass(SkippedTests):
|
||||
pass
|
||||
|
||||
test_suite = unittest.TestSuite()
|
||||
test_suite.addTest(NotSkippedTests('test_dummy'))
|
||||
try:
|
||||
test_suite.addTest(SkippedTests('test_will_be_skipped'))
|
||||
test_suite.addTest(SkippedTestsSubclass('test_will_be_skipped'))
|
||||
except unittest.SkipTest:
|
||||
self.fail("SkipTest should not be raised at this stage")
|
||||
result = unittest.TextTestRunner(stream=six.StringIO()).run(test_suite)
|
||||
self.assertEqual(result.testsRun, 2)
|
||||
self.assertEqual(len(result.skipped), 1)
|
||||
self.assertEqual(result.testsRun, 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__')
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='test_utils.urls')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue