Info messages in python unit testing

I am using Python module unittest

for unit testing.

I would like to be able to report informational messages as part of a unit test output other than a transfer / failure state. Specifically, in my case, I want to let you know if the module under test is using a pure Python implementation or a C extension.

Is there a mechanism unittest

for displaying informational messages as part of the test report? Can this be done in Python unit test alternate frames?

+2


a source to share


2 answers


I didn't know about Nosetet and it makes sense to use this plugin for a variety of reasons. I would use logging myself .



+1


a source


Yes, you can use nosetests , which has a plugin system that allows this. For example, the TestResult api allows you to provide advanced reports:



Provides a TextTestResult that extends unittests _TextTestResult to provide support for error classes (such as inline skips and deprecated classes) and hooks for plugins to capture or extend reporting.

+3


a source







All Articles