Testing A FastAPI App With Pytest

Veröffentlicht am: 20 April 2025
auf dem Kanal: Ssali Jonathan
5,801
153

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-Fast...

PLEASE DONATE TO THE CHANNEL THROUGH:
BUY ME A COFFEE:
https://buymeacoffee.com/jod35

PATREON:
  / 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


Auf dieser Seite können Sie das Online-Video Testing A FastAPI App With Pytest mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Ssali Jonathan 20 April 2025 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,801 Mal angesehen und es wurde von 153 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!