Unit Testing In FastAPI (Using It's In-Built Test Client) With Pytest

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น •

  • @SsaliJonathan
    @SsaliJonathan  2 ปีที่แล้ว +1

    How do you test your FastAPI apps?

  • @IPADrinker
    @IPADrinker ปีที่แล้ว

    Best compliment one can afford regarding a video like this one... your content was wonderfully succinct. To many times people posting coding related content based on a concept will add unnecessary concepts that is off of the point. You are to the point here, which I think is VERY helpful. One suggestion that I found when working through the content is that I had to import httpx . Maybe it was just my virtual environment's configuration verses yours, but that may have been worth mentioning as a requirement. Thanks for the enlightenment.

  • @AjayManjhi-g2o
    @AjayManjhi-g2o ปีที่แล้ว

    great small and to the point simple example 👌

  • @ClaudiaVanDijk-w8i
    @ClaudiaVanDijk-w8i ปีที่แล้ว

    Great explanation and done quickly. Thank you!

  • @sherjeelhashmi6257
    @sherjeelhashmi6257 ปีที่แล้ว

    pretty cool explanation man. Way to go concise and concrete

  • @deaddoomed2380
    @deaddoomed2380 5 หลายเดือนก่อน

    thanks man I understood in the moment

  • @maxjokar7920
    @maxjokar7920 2 ปีที่แล้ว

    Man, ur videos r vwtting better and better. Bravo

  • @jeetukumargupta8051
    @jeetukumargupta8051 ปีที่แล้ว

    When i import the app, it calls the main file and executes the main files import statements which ultimately fails at the get os.environ statements. what can be done in this?

    • @SsaliJonathan
      @SsaliJonathan  ปีที่แล้ว +1

      Please provide some details. You can even send me an email

  • @sweetshoez
    @sweetshoez ปีที่แล้ว

    Gave you a like, good stuff brother keep the good stuff coming!

  • @nitinmatale8278
    @nitinmatale8278 ปีที่แล้ว

    very good explaination

  • @subashvoleti1013
    @subashvoleti1013 ปีที่แล้ว

    Your videos are really awesome with good explanation. I followed every fastapi video which was very cool. But I was not able to understand the implementation of mocking and patching of fast api . Could you please do some videos related to it. Which includes the mocking data base connectivity in backend and involvement of Google big query. If possible could you please explain Test driven development of fast api's

    • @SsaliJonathan
      @SsaliJonathan  ปีที่แล้ว

      Sure. I will be making some videos about this in the near future.

  • @niketnikumbh2347
    @niketnikumbh2347 ปีที่แล้ว

    Very good explanation @SsaliJonathan...

  • @IbrahimRasheed-pg6us
    @IbrahimRasheed-pg6us 2 ปีที่แล้ว

    how i test if my app depends on APIroute

  • @pipi_delina
    @pipi_delina ปีที่แล้ว

    I have a folder app and another folder called test. My tests fail always... This is my first time attempting to write tests

    • @SsaliJonathan
      @SsaliJonathan  ปีที่แล้ว

      Rename the folder to tests. Also name your test functions test_something. Hope it helps

  • @nosiphondlovu6751
    @nosiphondlovu6751 ปีที่แล้ว

    Are you available for tutoring?

  • @blindeveloper
    @blindeveloper ปีที่แล้ว

    thanks a lot!

  • @yusifaliyarov3180
    @yusifaliyarov3180 ปีที่แล้ว

    you used pytest even though you wrote in the title that unittest are two different libraries

    • @SsaliJonathan
      @SsaliJonathan  ปีที่แล้ว +2

      Unit testing . Is a term used to mean tests that focus on one small unit of functionality. Wasn’t necessarily meaning the unittest module that comes with python. FastApi provides its test client. In the example, we used pytest to run the tests

  • @oreaba
    @oreaba 2 ปีที่แล้ว

    good job

  • @RobertoGarcia-w7y
    @RobertoGarcia-w7y ปีที่แล้ว +1

    Well thanks for the video but this isn't unit testing this is acceptance or functional testing at all, unit tests philosophy is all the opposite that you did because in a unitary way you never reach infrastructure services like database, cache, web servers, etc, unit test is about given some inputs check the outputs but just for one unit of code and not for the whole application. Happy coding ;)

    • @SsaliJonathan
      @SsaliJonathan  ปีที่แล้ว

      I love the feedback from you. Thanks for sharing. Would love to hear more about this

  • @yusifaliyarov3180
    @yusifaliyarov3180 ปีที่แล้ว +1

    this not unit