sanic-testing icon indicating copy to clipboard operation
sanic-testing copied to clipboard

Test clients for Sanic

Results 12 sanic-testing issues
Sort by recently updated
recently updated
newest added

**Motivation:** The SanicASGITestClient class provides only a client that lifts a new instance of the test application for each request. This is very expensive and time-consuming. The application I'm trying...

How to reproduce ```python import pytest from sanic_testing.reusable import ReusableClient from sanic import Sanic from sanic import response @pytest.fixture(scope="session") def app(): sanic_app = Sanic("TestSanic") @sanic_app.get("/") def basic(request): return response.text("foo") @sanic_app.post("/api/login")...

I am trying to test app with TortoiseORM and i dont understand what is the right way to setup my test application in fixture. I was tried to make with...

Extend sanic-testing with tox tests to ensure python 3.12 is support by the library

`Sanic-testing` uses `httpx` under the hood, which makes monkeypatching httpx requests hard to implement. For example if we have and endpoint which makes external requests, and if we monkeypatch this...

The type annotation of Sanic app's `test_client` currently is `Any`. Create a better type for it can make test dev experience better. I think adding a parent class, either abstract...

enhancement

I'm experiencing an issue while testing a Sanic application asynchronously using pytest. According to the Sanic documentation, the SanicASGITestClient should not spin up a server on every request. However, in...

Hello there! `SanicASGITestClient` inherits from `httpx.AsyncClient` and override its `request` method, changing its return type. ```python class SanicASGITestClient(httpx.AsyncClient): async def request( # type: ignore self, method, url, gather_request=True, *args, **kwargs...

Fixes #77 Updates the `websockets` dependency to v14.0, since `websockets.legacy` is deprecated.

`websockets` v14.0 was released yesterday which deprecates use of `websockets.legacy`: https://github.com/python-websockets/websockets/blob/f0d20aafab027e9b99460b193dcb709872b219a5/src/websockets/legacy/__init__.py#L7 This breaks `sanic-testing` as it relies on `websockets.legacy` via `from websockets.legacy.client import connect` in `websocket.py` The `websockets` [upgrade guide](https://websockets.readthedocs.io/en/stable/howto/upgrade.html)...