Chapter 3: Introduction to Pytest
Alfredo Deza
I remember when I started writing tests to be confused on how to run them. At the time, a project called nose
was what everyone used, and it is what I ended up picking up. It still required one to use Python’s unit test library, which forces one to use classes and inheritance for tests. I was starting with Python and didn’t have a good grasp on classes, let alone on inheritance! The experience wasn’t great; I dreaded writing tests.
At some point, I found myself having some issue in a test that forced me to try out the Pytest project to check if it was a problem in my code or a problem with the test runner. Pytest didn’t have any issues, and I found the output and experience so lovely that I kept ...
Get Testing In Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.