5 SIMPLE Pytest tricks to improve your tests

Поделиться
HTML-код
  • Опубликовано: 20 окт 2024

Комментарии • 10

  • @galer7
    @galer7 2 месяца назад

    I just discovered property-based testing thanks to your video 🙏

  • @jancicruz7
    @jancicruz7 2 месяца назад +2

    2 things that could have been mentioned:
    - pytest --cov=my_package --cov-report=html : it outputs an html file which color codes coverage and is quite nice visual representation of cov
    - might not be strictly pytest related, but configuring the testing extension in VS Code enables the tests to be run individually by just clicking on the green "play" button to the left of the functions (next to line numbers), which is super nice, especially when you are writing the test and don't know if it will work, you can just click that button over and over again instead of going to terminal and starting the whole unit test session with the commands.

    • @Carberra
      @Carberra  2 месяца назад +1

      Oooo that HTML report type sounds cool, might have to give that a shot when I get the chance.

  • @plouf1969
    @plouf1969 Месяц назад

    The trick I would have mentioned is fixtures. It's super powerful, composable and is really good for parametrization.

  • @farzadmf
    @farzadmf 2 месяца назад

    GREAT video with super useful tips; thank you!

    • @Carberra
      @Carberra  2 месяца назад +1

      You're welcome! 😄

  • @MarthinusBosman
    @MarthinusBosman 2 месяца назад

    I'd guess if you have a significant conftest setup that xdist would also slow down significantly, since it needs to run conftest for each process

  • @teprox7690
    @teprox7690 2 месяца назад +1

    2:31: one question: does the test cover the free space between the bananas? 😉You test everytime against your own assumptions... not against the universe.

    • @Carberra
      @Carberra  2 месяца назад +1

      The comment of a true tester!