Python Zero to Hero - Ep.7 - Unit testing with Pytest

Update: the reason why I cannot install pytest in my environment is that I have installed conda yesterday and it messed up the path. Somehow conda overrides the pyenv paths so they cannot exist together. You can either keep it and use python -m pytest every time instead of pytest or, like me, remove conda so it works again.

Testing is very important in software development. Unit testing is the smallest building block of your tests. It locks a unit of your code in place so making debugging much easier. Today we will use Pytest, a popular testing library in Python, to do some unit testing. We only cover the basics today and if you are interested to learn more about testing using pytest or other libraries, please leave your comment at my Twitch channel

You can get the slide deck here and the example code and homework form GitHub here. Ask questions at my Twitch channel

Also, check out Naomi Ceder’s Twitch channel for more beginner’s (slightly more advance) tutorial.

See more of my talks on YouTube.




After having a career as a Data Scientist and Developer Advocate, Cheuk dedicated her work to the open-source community and working as a community manager at OpenSSF. She has co-founded Humble Data, a beginner Python workshop that has been happening around the world. She has served the EuroPython Society board for two years and is now a fellow and director of the Python Software Foundation.