def wrapper(*args, **kwargs): try: function(*args, **kwargs) except Exception: splinter_tests.screenshot(filename) raise
def screenshot_on_exception(filename): try: yield except Exception: splinter_tests.screenshot(filename) raise