Guard against application of an XFAIL decorator on a class

This does not work and causes the class to be silently skipped, which is a bad idea. This makes
sure it cannot happen accidentaly. I've played with the idea of actually making the decorator
work at class level, but it proved too magic to do at this moment.

llvm-svn: 258048
This commit is contained in:
Pavel Labath 2016-01-18 14:45:35 +00:00
parent 239fda676c
commit 4da73573ab
1 changed files with 2 additions and 0 deletions

View File

@ -593,6 +593,8 @@ def not_remote_testsuite_ready(func):
def expectedFailure(expected_fn, bugnumber=None):
def expectedFailure_impl(func):
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
raise Exception("Decorator can only be used to decorate a test method")
@wraps(func)
def wrapper(*args, **kwargs):
from unittest2 import case