testing-cabal/testtools — pull request #82 by thomir (2014-03-04 23:12:19+00:00)
Title: Fix expected failure

Python 3.4's unittest module introduces the concept of subtests. As part of this change, the 'expectedFailure' decorator was changed.

Before python 3.4, it looked like this:

```
def expectedFailure(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
func(*args, **kwargs)
except Exception:
raise _ExpectedFailure(sys.exc_info())
raise _UnexpectedSuccess
return wrapper
```

After python 3.4, it looks like this:

```
def expectedFailure(test_item):
test_item.__unittest_expecting_failure__ = True
return test_item
```

This breaks tests that use testtools.TestCase and unittest.expectedFailure together.

This pull request detects the new-style expectedDecorator on a test, and silently wraps it in the old decorator, thereby maintaining compatibility.