File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ def skip(reason):
6161 Unconditionally skip a test.
6262 """
6363 def decorator (test_item ):
64- if not ( isinstance (test_item , type ) and issubclass ( test_item , TestCase ) ):
64+ if not isinstance (test_item , type ):
6565 @functools .wraps (test_item )
6666 def skip_wrapper (* args , ** kwargs ):
6767 raise SkipTest (reason )
Original file line number Diff line number Diff line change @@ -66,6 +66,21 @@ def test_1(self):
6666 self .assertEqual (result .skipped , [(test , "testing" )])
6767 self .assertEqual (record , [])
6868
69+ def test_skip_non_unittest_class (self ):
70+ @unittest .skip ("testing" )
71+ class Mixin :
72+ def test_1 (self ):
73+ record .append (1 )
74+ class Foo (Mixin , unittest .TestCase ):
75+ pass
76+ record = []
77+ result = unittest .TestResult ()
78+ test = Foo ("test_1" )
79+ suite = unittest .TestSuite ([test ])
80+ suite .run (result )
81+ self .assertEqual (result .skipped , [(test , "testing" )])
82+ self .assertEqual (record , [])
83+
6984 def test_expected_failure (self ):
7085 class Foo (unittest .TestCase ):
7186 @unittest .expectedFailure
Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ Core and Builtins
7171Library
7272-------
7373
74+ - Issue #14664: It is now possible to use @unittest.skip{If,Unless} on a
75+ test class that doesn't inherit from TestCase (i.e. a mixin).
76+
7477- Issue #4892: multiprocessing Connections can now be transferred over
7578 multiprocessing Connections. Patch by Richard Oudkerk (sbt).
7679
You can’t perform that action at this time.
0 commit comments