Browse Source

Fix leak in leak detection code

If ensure_clean_request_context found a leak, it would raise an
AssertionError and not clean up the leak, and therefore affect other
testcases.
pull/739/head
Markus Unterwaditzer 12 years ago
parent
commit
3d36d6efb9
  1. 5
      flask/testsuite/__init__.py

5
flask/testsuite/__init__.py

@ -116,7 +116,10 @@ class FlaskTestCase(unittest.TestCase):
def ensure_clean_request_context(self):
# make sure we're not leaking a request context since we are
# testing flask internally in debug mode in a few cases
self.assert_equal(flask._request_ctx_stack.top, None)
leaks = []
while flask._request_ctx_stack.top is not None:
leaks.append(flask._request_ctx_stack.pop())
self.assert_equal(leaks, [])
def setup(self):
pass

Loading…
Cancel
Save