Author: zturner Date: Fri Nov 6 12:14:42 2015 New Revision: 252326 URL: http://llvm.org/viewvc/llvm-project?rev=252326&view=rev Log: Don't use module internal implementation details in our decorators.
We tried implementing something akin to a conditionalExpectedFailure decorator for unittest2. We did this by making use of some implementation details of the unittest2 module. In an effort to make this work with unittest, this patch removes the reliance on the implementation details. I have a hard time wrapping my head around how this all works with the deeply nested decorators, but the spirit of the patch here is to do do the following: If the condition function is true, use the original unittest2.expectedFailure decorator. Otherwise don't use any decorator, just call the test function. Differential Revision: http://reviews.llvm.org/D14406 Reviewed By: tberghammer, labath Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=252326&r1=252325&r2=252326&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Nov 6 12:14:42 2015 @@ -601,15 +601,11 @@ def expectedFailure(expected_fn, bugnumb def wrapper(*args, **kwargs): from unittest2 import case self = args[0] - try: - func(*args, **kwargs) - except Exception: - if expected_fn(self): - raise case._ExpectedFailure(sys.exc_info(), bugnumber) - else: - raise if expected_fn(self): - raise case._UnexpectedSuccess(sys.exc_info(), bugnumber) + xfail_func = unittest2.expectedFailure(func) + xfail_func(*args, **kwargs) + else: + func(*args, **kwargs) return wrapper # if bugnumber is not-callable(incluing None), that means decorator function is called with optional arguments # return decorator in this case, so it will be used to decorating original method _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits