diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-08-22 11:18:21 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-08-22 12:25:03 -0700 |
commit | a71ff8f1ea768159ff8ff6b9146a06530ee0356b (patch) | |
tree | 24fae8314a422798e18ce3ef8ab4989516dd9289 /tests/utilities.py | |
parent | 112dd7cee458b867f0851c502d0c2d4a06c964de (diff) |
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).
Diffstat (limited to 'tests/utilities.py')
-rw-r--r-- | tests/utilities.py | 10 |
1 files changed, 10 insertions, 0 deletions
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 |