remove testmanager
This commit is contained in:
parent
933d005e5d
commit
1f0f4ef5d5
23
sanic/app.py
23
sanic/app.py
@ -86,7 +86,8 @@ class Sanic:
|
|||||||
self.websocket_tasks: Set[Future] = set()
|
self.websocket_tasks: Set[Future] = set()
|
||||||
self.named_request_middleware: Dict[str, MiddlewareType] = {}
|
self.named_request_middleware: Dict[str, MiddlewareType] = {}
|
||||||
self.named_response_middleware: Dict[str, MiddlewareType] = {}
|
self.named_response_middleware: Dict[str, MiddlewareType] = {}
|
||||||
self._test_manager = None
|
self._test_client = None
|
||||||
|
self._asgi_client = None
|
||||||
# Register alternative method names
|
# Register alternative method names
|
||||||
self.go_fast = self.run
|
self.go_fast = self.run
|
||||||
|
|
||||||
@ -1032,21 +1033,21 @@ class Sanic:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def test_client(self):
|
def test_client(self):
|
||||||
if self._test_manager:
|
if self._test_client:
|
||||||
return self._test_manager.test_client
|
return self._test_client
|
||||||
from sanic_testing import TestManager
|
from sanic_testing.testing import SanicTestClient
|
||||||
|
|
||||||
manager = TestManager(self)
|
self._test_client = SanicTestClient(self)
|
||||||
return manager.test_client
|
return self._test_client
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def asgi_client(self):
|
def asgi_client(self):
|
||||||
if self._test_manager:
|
if self._asgi_client:
|
||||||
return self._test_manager.asgi_client
|
return self._asgi_client
|
||||||
from sanic_testing import TestManager
|
from sanic_testing.testing import SanicASGITestClient
|
||||||
|
|
||||||
manager = TestManager(self)
|
self._asgi_client = SanicASGITestClient(self)
|
||||||
return manager.asgi_client
|
return self._asgi_client
|
||||||
|
|
||||||
# -------------------------------------------------------------------- #
|
# -------------------------------------------------------------------- #
|
||||||
# Execution
|
# Execution
|
||||||
|
@ -6,6 +6,8 @@ import uuid
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from sanic_testing import TestManager
|
||||||
|
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
from sanic.router import RouteExists, Router
|
from sanic.router import RouteExists, Router
|
||||||
|
|
||||||
@ -129,4 +131,6 @@ def url_param_generator():
|
|||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def app(request):
|
def app(request):
|
||||||
return Sanic(request.node.name)
|
app = Sanic(request.node.name)
|
||||||
|
# TestManager(app)
|
||||||
|
return app
|
||||||
|
Loading…
x
Reference in New Issue
Block a user