Ensure that nobody can nest test client invocations

This commit is contained in:
Armin Ronacher 2011-08-25 15:33:03 +01:00
parent f051939d8b
commit 311ac0f533

View file

@ -108,6 +108,8 @@ class FlaskClient(Client):
self.context_preserved = _request_ctx_stack.top is not old
def __enter__(self):
if self.preserve_context:
raise RuntimeError('Cannot nest client invocations')
self.preserve_context = True
return self