I wanted to start a real mock server with real instances that I could fine tune for my own needs.
I found a way to start the FastAPI to run the tests agains it, and then kill the uvicorn.
Here an example code 👍
We have some app and dishka container
from fastapi import FasAPI
from dishka.integrations.fastapi import Depends, inject, setup_dishka
router = APIRouter()
@router.get("/")
@inject| from typing import Generator | |
| import pytest | |
| from sqlalchemy import Engine, create_engine | |
| from sqlalchemy.orm import Session, sessionmaker | |
| from .models import Base | |
| @pytest.fixture(name="engine", scope="session") | 
| { | |
| programs.niri.settings.animations = { | |
| window-open = { | |
| easing = { | |
| curve = "ease-out-expo"; | |
| duration-ms = 800; | |
| }; | |
| }; | |
| window-close = { | |
| easing = { | 
| # Adapted from original PKGBUILD by Harry Walker <[email protected]> | |
| pkgname=libfprint-focaltech | |
| pkgver=0.1 | |
| pkgrel=1 | |
| pkgdesc="Proprietary driver for the Focaltech fingerprint reader" | |
| arch=('x86_64') | |
| url="https://github.com/ftfpteams/focaltech-linux-fingerprint-driver" | |
| depends=('glib2>=2.56' 'libgusb>=0.3.0' 'nss>=3.13.4' 'pixman>=0.30.0') | |
| conflicts=('libfprint') | |
| provides=('libfprint-2.so' 'libfprint') |