MENU

Fun & Interesting

Testing A FastAPI App With Pytest

Ssali Jonathan 671 2 weeks ago
Video Not Working? Fix It Now

In this video, I explore integration testing for FastAPI applications, focusing on using the FastAPI TestClient alongside Pytest. I cover essential Pytest concepts and their application in testing FastAPI apps. The discussion begins with testing a basic app, then progresses to a more advanced setup involving a database with an async DB API. #fastapi #python #pytest SOURCE CODE: https://github.com/jod35/Testing-FastAPI-Apps-With-Pytest PLEASE DONATE TO THE CHANNEL THROUGH: BUY ME A COFFEE: https://buymeacoffee.com/jod35 PATREON: https://www.patreon.com/jod35 You can also consider becoming a member of this channel. FOLLOW ME: X: https://x.com/jod35_ GITHUB: http://github.com/jod35 TIMESTAMPS: 00:00:00 Intro 00:01:35 A tour of the first project 00:04:32 Install Pytest 00:04:49 Set Up the tests 00:05:50 Create the test client fixture 00:10:00 Write the first test 00:19:08 Intro to test coverage 00:30:56 A tour of the second project 00:39:08 The pytest.ini file 00:43:02 Intro to Pytest markers 00:49:11 Intro to fixture scopes 00:51:34 Create a test 00:54:16 Create a database for testing 00:59:34 Overriding FastAPI dependencies 01:05:30 Explaining the rest of the tests 01:10:54 Outro

Comment