6
submitted 6 months ago by vi21@lemmy.ml to c/python@lemmy.ml

The default approach involves using TestClient. However, I found that mocking the database, background tasks, etc., is overkill. Do you have any suggestions?

top 2 comments
sorted by: hot top new old
[-] bradbeattie@lemmy.ca 1 points 3 months ago

If you don't want to test the round trip, have your fastapi routes call some other function and test just that function.

[-] vi21@lemmy.ml 1 points 2 months ago

Do you mean moving Pydantic models as arguments of other function?

this post was submitted on 31 Jul 2025
6 points (100.0% liked)

Python

3579 readers
1 users here now

News and discussions about the programming language Python


founded 6 years ago
MODERATORS