DEV Community

Play Button Pause Button

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

Cheuk Ting Ho 🐍
DevRel 🥑 for TerminusDB. EuroPython Board member. Organizer of London Python Sprints and AI Club for Gender Minorities. Pythonista. Speaker and master of Lightning Talk!
・1 min read

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.

Discussion (1)

thisdotmedia_staff profile image
Forem Open with the Forem app