Chapter 2: Testing Conventions
Alfredo Deza
There are specific unwritten rules for testing in Python that are followed by most projects and are supported by tooling. Most tooling (like test runners) allows you to configure them to adapt to whatever structure you want, but understanding the conventions makes it easier for the tools and project collaborators. The least amount of surprises, the better!
In this chapter, I go into details on file layouts, directories, and naming conventions. Test runners like pytest benefit from these conventions for automatic discovery, which is how tests are found and later executed.
The first time I found myself writing tests for a small script I created, I wasn’t entirely sure where to place them and if I needed ...
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.