Skip to content

Instantly share code, notes, and snippets.

@weissjeffm
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save weissjeffm/96622ca0c21ad095cb28 to your computer and use it in GitHub Desktop.

Select an option

Save weissjeffm/96622ca0c21ad095cb28 to your computer and use it in GitHub Desktop.
In [2]:
def mytest():
try:
print "running test"
raise Exception("oh noes")
finally:
print "cleaning up test"
def pytest_exception_interact():
print "handling error"
def pytest_test_runner(test):
try:
print "starting test"
test()
except:
print "test failed"
pytest_exception_interact()
finally:
print "pytest cleaning up"
pytest_test_runner(mytest)
starting test
running test
cleaning up test
test failed
handling error
pytest cleaning up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment