5 Building and maintaining a test suite
This chapter covers
- Running unit tests with pytest
- Creating test coverage reports with pytest-cov
- Reducing duplicated test code with parameterization
- Automating packaging for testing using tox
- Creating a test matrix
Tests are an important aspect of any project you plan to maintain. They can ensure that new functionality behaves as you expect and that existing functionality hasn’t regressed. Tests are the guardrails for refactoring code—a common activity as projects mature.
With all this value that tests provide, you might think all open source packages would be thoroughly tested. But many projects pass on things like code coverage or testing for multiple target platforms because of the maintenance burden ...
Get Publishing Python Packages 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.