Browse Source

Ensure that nobody can nest test client invocations

pull/308/merge
Armin Ronacher 13 years ago
parent
commit
311ac0f533
  1. 2
      flask/testing.py

2
flask/testing.py

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

Loading…
Cancel
Save