From a71ff8f1ea768159ff8ff6b9146a06530ee0356b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 22 Aug 2017 11:18:21 -0700 Subject: tests/utilities: Add expected_failure decorator for twisted.trial tests Twisted.trail.unittest doesn't provide an expectedFailure decorator, nor does it work with the one from the builtin library. Instead it relies on having a "todo" attribute set. This new utilities decorator simply sets that attribute to a string value (booleans don't work). --- tests/utilities.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/utilities.py') diff --git a/tests/utilities.py b/tests/utilities.py index 402feb38..8123afd8 100644 --- a/tests/utilities.py +++ b/tests/utilities.py @@ -171,3 +171,13 @@ def make_key(revoked=False, expired=False, invalid=False, can_encrypt=True, mock_key.can_sign = can_sign return mock_key + + +def expected_failure(func): + """For marking expected failures for twisted.trial based unit tests. + + The builtin unittest.expectedFailure does not work with twisted.trail, + there is an outstanding bug for this, but no one has ever fixed it. + """ + func.todo = 'expected failure' + return func -- cgit v1.2.3