allowing output of code that is unittested?

Diez B. Roggisch deets at
Wed Jul 15 23:46:52 CEST 2009

per schrieb:
> hi all,
> i am using the standard unittest module to unit test my code. my code
> contains several print statements which i noticed are repressed when i
> call my unit tests using:
> if __name__ == '__main__':
>     suite = unittest.TestLoader().loadTestsFromTestCase(TestMyCode)
>     unittest.TextTestRunner(verbosity=2).run(suite)
> is there a way to allow all the print statements in the code that is
> being run by the unit test functions to be printed to stdio?  i want
> to be able to see the output of the tested code, in addition to the
> output of the unit testing framework.

I use nosetests to discover & run tests, and that has an "-s"-option 
that does exactly that.


More information about the Python-list mailing list