5 SIMPLE Pytest tricks to improve your tests

Опубликовано: 13 Февраль 2025
на канале: Carberra
4,222
233

In production code, the tests are often as important as the code, if not more. Without proper testing, how will you know if your code will ever work in the wild? In this video, I share five top tips to improve your tests and to make sure they're working properly!

00:00 - Intro
00:41 - Context [1]
01:33 - Parametrization [2]
03:22 - Finding edge cases w/ Hypothesis [3]
05:41 - Tracking coverage w/ pytest-cov [4]
08:17 - Reducing inter-test dependencies w/ pytest-randomly [5]
10:55 - Parallel testing w/ pytest-xdist [6-7]
13:45 - Outro

[1] https://github.com/Carberra/perfect-p...
[2] https://docs.pytest.org/en/stable/exa...
[3] https://hypothesis.works
[4] https://pytest-cov.readthedocs.io/en/...
[5] https://github.com/pytest-dev/pytest-...
[6] https://pytest-xdist.readthedocs.io/e...
[7] https://pytest-xdist.readthedocs.io/e...



If you want to see more of me, join my Discord server!
  / discord  

I get a lot of people asking, so here's my setup!
• Visual Studio Code:    • My Visual Studio Code setup! (2024)  
• Terminal:    • Make your terminal look AMAZING  
• Desk/recording gear: https://kit.co/Carberra
• PC build: https://uk.pcpartpicker.com/list/TmzGYN

Affiliations (I may earn a commission):
• Codecrafters -- 40% off any plan: https://app.codecrafters.io/join?via=...
• Keeper Password Manager -- 30% off your first year: https://keeper.io/r/EX4FB1C



If you have any questions, don't hesitate to ask in the comments! I'll try and answer as soon as I can, providing someone else hasn't already done so.

#python #coding #howto