Back to Browse

5 SIMPLE Pytest tricks to improve your tests

5.2K views
Jul 29, 2024
14:14

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-python/tree/main/2404-pytest-tricks [2] https://docs.pytest.org/en/stable/example/parametrize.html [3] https://hypothesis.works [4] https://pytest-cov.readthedocs.io/en/latest [5] https://github.com/pytest-dev/pytest-randomly [6] https://pytest-xdist.readthedocs.io/en/latest [7] https://pytest-xdist.readthedocs.io/en/latest/distribution.html — If you want to see more of me, join my Discord server! https://discord.gg/5vVgQpK I get a lot of people asking, so here's my setup! • Visual Studio Code: https://youtu.be/PBQspYkkksU • Terminal: https://youtu.be/4RuGK3w6Mbs • 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=parafoxia • 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

Download

0 formats

No download links available.

5 SIMPLE Pytest tricks to improve your tests | NatokHD