fix: fix woodpecker pipelines
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from contextlib import asynccontextmanager
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
@@ -8,22 +8,22 @@ from app.main import app_factory, lifespan, main
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_lifespan():
|
||||
async def test_lifespan() -> None:
|
||||
app = FastAPI()
|
||||
assert isinstance(lifespan, asynccontextmanager(lifespan).__class__)
|
||||
assert isinstance(lifespan, asynccontextmanager(lifespan).__class__) # type: ignore[arg-type]
|
||||
|
||||
async with lifespan(app):
|
||||
pass
|
||||
|
||||
|
||||
def test_app_factory():
|
||||
def test_app_factory() -> None:
|
||||
app = app_factory()
|
||||
assert isinstance(app, FastAPI)
|
||||
assert app.router.lifespan_context == lifespan
|
||||
|
||||
|
||||
@patch("app.main.uvicorn.run")
|
||||
def test_main(mock_uvicorn_run):
|
||||
def test_main(mock_uvicorn_run: Mock) -> None:
|
||||
main()
|
||||
mock_uvicorn_run.assert_called_once_with(
|
||||
app_factory,
|
||||
|
||||
Reference in New Issue
Block a user