Modification of Starlette TestClient to support async calls
Project description
Description
Modification of Starlette TestClient to support async calls.
Provides async receive*
, send*
for WebSocketTestSession
.
This module is meant to be used with pytest-asyncio
.
Installation
pip install starlette_async_wstc
Usage example
from starlette_async_wstc import TestClient
from somwhere import app # starlette/fastapi app
async def test():
client = TestClient(app)
async with client.websocket_connect('/ws') as wsclient:
await wsclient.send_json({'data': 'test_data'})
resp = await wsclient.receive_json()
assert resp == {}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file starlette_async_wstc-0.1.0.tar.gz
.
File metadata
- Download URL: starlette_async_wstc-0.1.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 135e333dfed2eb20f8a760c88ee06cf8179117db6cda39b7d32a226f1a7e05b1 |
|
MD5 | 343c21f17ac99ac2ddf55aa4ac7565e8 |
|
BLAKE2b-256 | da04d0768074496fc3696f91f8d11a7d1762e3e142d6e5e5323ad28f31ba9d32 |
File details
Details for the file starlette_async_wstc-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: starlette_async_wstc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc88b8a32060069f394056c99975e2216dfbc7dacf4db1ac961ccec108382d78 |
|
MD5 | da41493bd91dea5cc2dfde2cc5cb25d0 |
|
BLAKE2b-256 | ebcdcdb2a7594a69a0252cebb17b7d27adfef54f14629c67977e019a4e8eaca9 |