From 311ac0f533bf5a308200a51b861a9728b9223276 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 25 Aug 2011 15:33:03 +0100 Subject: [PATCH] Ensure that nobody can nest test client invocations --- flask/testing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flask/testing.py b/flask/testing.py index c1844c00..dfdaff57 100644 --- a/flask/testing.py +++ b/flask/testing.py @@ -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