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 in data science, Cheuk now brings her knowledge in data and passion for the tech community as the developer advocate. Cheuk constantly contributes to the open-source community by giving free talks and tutorials and organize sprints to encourage diversity contributions.