In FastApi test fails as expected but in litestar test success
FastApi example:
from fastapi import FastAPI
from fastapi.testclient import TestClient
app = FastAPI()
@app.get("/always-error")
def always_error() -> str:
raise RuntimeError("error")
def test_always_error():
with TestClient(app=app) as client:
client.get("/always-error")
Litestar example:
from litestar import Litestar, get
from litestar.testing import TestClient
@get("/always-error")
def always_error() -> str:
raise RuntimeError("error")
app = Litestar(route_handlers=[always_error])
def test_always_error():
with TestClient(app=app) as client:
client.get("/always-error")
How to achieve the same behavior from litestar as in fastapi?