deprecate before_first_request

This commit is contained in:
David Lord 2022-06-06 10:00:21 -07:00
parent 7a2d5fb6df
commit 96c97dec09
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
6 changed files with 66 additions and 33 deletions

View file

@ -1684,9 +1684,11 @@ def test_no_setup_after_first_request(app, client):
def test_before_first_request_functions(app, client):
got = []
@app.before_first_request
def foo():
got.append(42)
with pytest.deprecated_call():
@app.before_first_request
def foo():
got.append(42)
client.get("/")
assert got == [42]
@ -1698,10 +1700,12 @@ def test_before_first_request_functions(app, client):
def test_before_first_request_functions_concurrent(app, client):
got = []
@app.before_first_request
def foo():
time.sleep(0.2)
got.append(42)
with pytest.deprecated_call():
@app.before_first_request
def foo():
time.sleep(0.2)
got.append(42)
def get_and_assert():
client.get("/")