@laszlomagyar3156

The quality of your content is amazing! Keep up the good work!

@vatsal_gamit

This is my first video on tests in python and its worth watching !! Keep doing the great work man!! 🙌🏼

@Ruthwikranganathbethapudi

How to unit test a FastAPI which is connected to Sqlite?

@tenzingyatso5096

Nice! Could you make the same with async test and test db (postgres)?

@prasenjitgiri919

are you runnig the main,py before running the test ? and what if the main.py file reads from os environment variables - how do you handle it without running the main  file? - btw, great video!

@h3ct0rjs

Thanks for this, have you test Tavern which can be used to run this test to using yaml and python ?

@amadzarak7746

Great vid!

@nuri3029

Great! Thank you

@_4p_

Impressive

@hemantgiri2377

sir, please make a video on fastapi with mvc architecture with celery and and redis.

@zeldacamila

How to unit test a FastAPI which is connected to postgresql, on a CI environment (using github actions)??

@adithyayelloju8296

When test cases become larger, How to refactor them?

@davidinawe791

Hello. I have a question for fastapi testing with pytest and if someone could help me it would be very much appreciated!

Essentially, what I need to do within my test is to simulate a server restart. But I do not understand how the server is actually started in pytest.

We are running our API with hypercorn. Hypercorns serv() function in our main.py takes the app as a parameter and from my understanding runs the server like you normally would with "hypercorn main:app" by just running the main.py. I just don't understand how the server is actually started with pytest. All we do in pytest (same as in this video) is to define the TestClient, but from my understanding the TestClient is only the one ACCESSING the server that is already running. Therfore I don't know how I could simulate a restart of the server in pytest (like stopping and restarting the execution of "hypercorn main:app" in cmd).
 Could anyone help me out here and tell me what I am misunderstanding?

@GaziAshiq

why did you install httpx? where did you use it?

@DhavalAhir10

Ohhh, I thought pytest is only for Django  based project.

In Django we used Rq Worker or Celery.

What it is in fastapi?

@jordiprim2668

One question: if I change de order in the tests does not work, I mean, when the test_create_todo() goes first, then the test_read_todos() returns one element, so assert response.json()==[] is not true. Yes, I know thant there is setup_function, but does not efect the response.json(). I check also with fixture(autouse=True) and nothing changes...Do you know something about that? Thanks.
Jordi.

@AlexanderLindholm-z1q

You didn't test status code 400

@CodingStudio

but this is not unittesting? this is integration tests?