mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
enable anyio for unit tests
This commit is contained in:
parent
408b39ea99
commit
a8458be925
@ -9,7 +9,7 @@ Example for [FastAPI](https://fastapi.tiangolo.com/) integration with [SQLAlchem
|
||||
|
||||
Beside of using latest and greatest version of [SQLAlchemy](https://www.sqlalchemy.org/) with it robustness, powerfulness and speed
|
||||
of [asyncpg](https://github.com/MagicStack/asyncpg) there is [FastAPI](https://fastapi.tiangolo.com/) (modern, fast (high-performance),
|
||||
web framework for building APIs with Python 3.9+ based on standard Python type hints.) already reviewed
|
||||
web framework for building APIs with Python 3.10+ based on standard Python type hints.) already reviewed
|
||||
on [thoughtworks](https://www.thoughtworks.com/radar/languages-and-frameworks?blipid=202104087).
|
||||
|
||||
|
||||
|
@ -4,9 +4,7 @@ import pytest
|
||||
from fastapi import status
|
||||
from httpx import AsyncClient
|
||||
|
||||
# decorate all tests with @pytest.mark.asyncio
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
pytestmark = pytest.mark.anyio
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"payload, status_code",
|
||||
|
@ -10,6 +10,16 @@ from the_app.database import get_db
|
||||
from the_app.main import app
|
||||
from the_app.models.base import Base
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
params=[
|
||||
pytest.param(("asyncio", {"use_uvloop": True}), id="asyncio+uvloop"),
|
||||
]
|
||||
)
|
||||
def anyio_backend(request):
|
||||
return request.param
|
||||
|
||||
|
||||
global_settings = config.get_settings()
|
||||
url = global_settings.asyncpg_test_url
|
||||
engine = create_async_engine(url, poolclass=NullPool, future=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user