I have some class-based unit tests running in python\'s unittest2 framework. We\'re using Selenium WebDriver, which has a convenient save_screenshot() method. I
Found a solution - I can override failureException:
@property
def failureException(self):
class MyFailureException(AssertionError):
def __init__(self_, *args, **kwargs):
self.b.save_screenshot('%s.png' % self.id())
return super(MyFailureException, self_).__init__(*args, **kwargs)
MyFailureException.__name__ = AssertionError.__name__
return MyFailureException
This seems incredibly hacky but it seems to work so far.