Created
October 8, 2013 13:57
-
-
Save satiani/6885103 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.teardown_request | |
def shutdown_request(exc=None): | |
if exc is not None: | |
print "An exception happened!" | |
def test_request_teardown(self): | |
try: | |
with self.app.test_request_context(): | |
raise Exception('dummy exception') | |
except: | |
pass | |
# as expected, "An exception happened!" is printed | |
# uncomment this to resolve the issue | |
# import sys; sys.exc_clear() | |
# now test with object updates instead of creation | |
with self.app.test_request_context(): | |
# do stuff that doesn't throw an exception | |
# here "An exception happened!" would be printed | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment