make Sanic.create_server return an asyncio.Server
- adding 2 new parameters to Sanic.create_server:
* return_asyncio_server=False - defines whether there's
a need to return an asyncio.Server or run it right away
* asyncio_server_kwargs=None - for python 3.7 uvloop doesn't
support all necessary features like "start_serving",
so, in order to make sanic work well with asyncio from 3.7
there's a need to introduce generic way for passing
kwargs for "loop.create_server"
Closes: #1469
This commit is contained in:
@@ -17,6 +17,11 @@ def test_app_loop_running(app):
|
||||
assert response.text == "pass"
|
||||
|
||||
|
||||
def test_create_asyncio_server(app):
|
||||
asyncio_srv = app.create_server(return_asyncio_server=True)
|
||||
assert isinstance(asyncio_srv, asyncio.AbstractServer)
|
||||
|
||||
|
||||
def test_app_loop_not_running(app):
|
||||
with pytest.raises(SanicException) as excinfo:
|
||||
app.loop
|
||||
|
||||
Reference in New Issue
Block a user