[issue18937] add unittest assertion for logging

Vinay Sajip report at bugs.python.org
Thu Sep 5 23:43:36 CEST 2013


Vinay Sajip added the comment:

I agree a context manager would be useful. Note that I have already provided a Handler subclass (TestHandler) as well as a Matcher class which allows matching of LogRecords, and which can be used in assertions. These are in test.support as they were originally intended for Python's own tests, but could be moved to the logging package if they are considered more generally useful.

See this for how to use them:

http://plumberjack.blogspot.co.uk/2010/09/unit-testing-and-logging.html

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18937>
_______________________________________


More information about the Python-bugs-list mailing list