Remove the async helper method

It is better to encourage users to utilise the app ensure_sync method
(or the newely added async_to_sync method) so that any extensions that
alter these methods take affect throughout the users code.

With the helper method users code fix parts of their code to the
asgiref async_to_sync ignoring any extension changes.
This commit is contained in:
pgjones 2021-05-03 10:59:28 +01:00 committed by David Lord
parent 7f87f3dd93
commit 2889da67cb
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
3 changed files with 34 additions and 28 deletions

View file

@ -6,7 +6,6 @@ import pytest
from flask import Blueprint
from flask import Flask
from flask import request
from flask.helpers import async_to_sync
pytest.importorskip("asgiref")
@ -136,5 +135,6 @@ def test_async_before_after_request():
@pytest.mark.skipif(sys.version_info >= (3, 7), reason="should only raise Python < 3.7")
def test_async_runtime_error():
app = Flask(__name__)
with pytest.raises(RuntimeError):
async_to_sync(None)
app.async_to_sync(None)