mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #14664: It is now possible to use @unittest.skip{If,Unless} on a test class that doesn't inherit from TestCase (i.e. a mixin).
This commit is contained in:
parent
c2ad0aa9f1
commit
b05ac864f0
3 changed files with 19 additions and 1 deletions
|
@ -66,6 +66,21 @@ class Test_TestSkipping(unittest.TestCase):
|
|||
self.assertEqual(result.skipped, [(test, "testing")])
|
||||
self.assertEqual(record, [])
|
||||
|
||||
def test_skip_non_unittest_class(self):
|
||||
@unittest.skip("testing")
|
||||
class Mixin:
|
||||
def test_1(self):
|
||||
record.append(1)
|
||||
class Foo(Mixin, unittest.TestCase):
|
||||
pass
|
||||
record = []
|
||||
result = unittest.TestResult()
|
||||
test = Foo("test_1")
|
||||
suite = unittest.TestSuite([test])
|
||||
suite.run(result)
|
||||
self.assertEqual(result.skipped, [(test, "testing")])
|
||||
self.assertEqual(record, [])
|
||||
|
||||
def test_expected_failure(self):
|
||||
class Foo(unittest.TestCase):
|
||||
@unittest.expectedFailure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue