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:
Antoine Pitrou 2012-04-25 17:31:12 +02:00
parent 00086bb7e8
commit 3815316714
3 changed files with 35 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import functools
import difflib
import pprint
import re
import types
import warnings
from . import result
@ -55,7 +56,7 @@ def skip(reason):
Unconditionally skip a test.
"""
def decorator(test_item):
if not (isinstance(test_item, type) and issubclass(test_item, TestCase)):
if not isinstance(test_item, (type, types.ClassType)):
@functools.wraps(test_item)
def skip_wrapper(*args, **kwargs):
raise SkipTest(reason)