Testing Flask Applications with pytest - Patrick Kennedy

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 14

  • @taylordiem1055
    @taylordiem1055 2 роки тому +7

    I’ve been avoiding unit tests for a while, but some of my users are commenting that there are small bugs that are detracting from the tools. This video is tremendously helpful in providing an overview and kickstart to using pytest. Excellent presentation and thank you!!

  • @sachinfulsunge9977
    @sachinfulsunge9977 Рік тому +1

    That was a very calming and soothing and relaxing explanation that really consolidates in my mind. Thank you

  • @Jak132619
    @Jak132619 Рік тому +1

    Thanks for the video, good to see a tutorial from a TDD advocate. I agree that Given, When, Then is a good structure to use for the actual code of a test, e.g.
    GIVEN: instantiate the class / setup functionality
    WHEN: call the function being tested
    THEN: assert
    but I question writing an actual comment of it above the test. If requirements change and therefore this test needs to change, there's a risk that this comment will become a lie if the programmer forgets to update it, however the code will always tell the truth

  • @DforDeathray
    @DforDeathray 2 роки тому +2

    Thank you so much, Patrick! I have been struggling with TDD for awhile now. Alot of the concepts really clicked watching this.

  • @villo2553
    @villo2553 2 роки тому +3

    This is a great presentation. Thanks you so much. You made me more understand about TDD.

  • @CalicoGoodrich
    @CalicoGoodrich 2 роки тому +1

    Incredibly helpful presentation! Thank you!

  • @EagerEggplant
    @EagerEggplant 2 роки тому +3

    Informative and great delivery. Thank you.

  • @thisisthebestid
    @thisisthebestid 2 роки тому +1

    Great video!

  • @kvicar7419
    @kvicar7419 2 роки тому +5

    So, as the explanation in video wasnt enough for me to understand the yield test_client vs return test_client, could you please provide me some additional explanation of why should we do it like this? Thanks in advance, this is the last puzzle I need to completly understand the concepts of pytest.

    • @vladislavkorecky
      @vladislavkorecky 2 роки тому +7

      Well the difference between them is actually pretty simple. When you "return" a value, the function that returned the value ends, and no other code in it will be executed. But when you call "yield" you return the value to the function above (just like with "return"), but the code still continues. This is important if you need some sort of a teardown or cleanup. The best example of using "yield" would be with file handling. Imagine that you have a function that opens a certain file and then returns it. But there is a problem, you also have to close the file after you return it. So, you change the "return" statement to "yield" and then call the .close() function below it. Hope that helps!

    • @kvicar7419
      @kvicar7419 2 роки тому +4

      @@vladislavkorecky Amazing answer Vladislav, highly appreciate that! :)

  • @jakubrudy9372
    @jakubrudy9372 2 роки тому +1

    Thank you, helped a lot!

  • @jerryb707
    @jerryb707 2 роки тому +4

    This is amazing!

  • @jamescat2386
    @jamescat2386 10 місяців тому

    unit test did not work 'TypeError: __init__() takes 1 positional argument but 2 were given' :-(