forked from orbit-oss/flask
Ensure that nobody can nest test client invocations
This commit is contained in:
parent
f051939d8b
commit
311ac0f533
1 changed files with 2 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue