Chapter 5. Testing your software

This chapter covers

  • Understanding the anatomy of a test
  • Using different testing approaches for your application
  • Writing tests with the unittest framework
  • Writing tests with the pytest framework
  • Adopting test-driven development

I’ve talked in previous chapters about writing clear code using well-named functions for maintainability, but that’s only part of the picture. As you add feature after feature, can you be sure the application still does what you meant it to? Any application you hope will live on long into the future needs some assurances of its longevity. Tests can help you make sure new features are built correctly, and you can run these tests again each time you update your code to make sure it stays ...

Get Practices of the Python Pro 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.