© Sunil Kapil 2019
Sunil KapilClean Pythonhttps://doi.org/10.1007/978-1-4842-4878-2_8

8. Debugging and Testing Python Code

Sunil Kapil1 
Sunnyvale, CA, USA

If you are writing code, especially for production, it’s really important that the code has good logging features and test cases. Both make sure that you can track errors and fix any issues that arise. Python has a rich set of built-in libraries for debugging and testing the Python code that I’ll cover in this chapter.


As with any programming language, Python has a lot of tools to add logs and tests in code. Having a good understanding of those tools is important in a professional environment where running software in production makes money for you. Losing money because of errors ...

Get Clean Python: Elegant Coding in Python now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.