PYTHON PROGRAMMING ADVANCED: The Guide for Data Analysis and Data Science. Discover Machine Learning With the Optimum Recipes for Mastering Python and ... (Crash Course Tips and Tricks Book 3) by ERIC MATTHEWS & LEWIS TAYLOR

PYTHON PROGRAMMING ADVANCED: The Guide for Data Analysis and Data Science. Discover Machine Learning With the Optimum Recipes for Mastering Python and ... (Crash Course Tips and Tricks Book 3) by ERIC MATTHEWS & LEWIS TAYLOR

Author:ERIC MATTHEWS & LEWIS TAYLOR [MATTHEWS, ERIC]
Language: eng
Format: azw3
Published: 2019-10-14T16:00:00+00:00


Chapter 11: Testing logging

Python comes with a logging package, and although it is popular among users, people tend to assume that logging calls need not be tested, or consider the prospect rather tiring. As an aid, TestFixtures lets a user capture the output of calls easily to the logging framework in Python, and ensure that the output fit what is expected of them.

Keep in mind that the LogCapture is used in checking that your code logs the right messages.

Techniques of capture

There are three distinct methods used in capturing messages that are logged into the logging framework in Python, depending on the form of the test being written. Below is a description of these techniques:

The context manager:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.