We started writing our functional and unit test cases in python using nose framework. We started learning python while writing these tests. Since there are lot of dependencies between our test classes/functions, we decided to use proboscis framework on top of nose to control order of execution.
We have quite a few ‘print’ statements in our tests and proboscis seems to be ignoring these! Tests are running in expected order and testing them all but not printing our print statement data to console. Any idea what we are missing here?
BTW, we stopped deriving our classes from ‘unittest.TestCase’ once we moved to proboscis and decorated all classes and their member functions with @test.
Note: According to the Proboscis documentation “unused arguments get passed along to Nose or the unittest module”, so the following should apply to Proboscis by replacing
nosetestswithpython run_tests.py.As @Wooble has mentioned in his comment, by default
nosecapturesstdoutand only displays it for failed tests. You can override this behaviour with thenosetests-sor--nocaptureswitch:Like @Wooble also mentions in his comment, I recommend using the logging module instead of
print. Then you only need to passnoseteststhe-l DEBUGor--debug=DEBUGswitch, whereDEBUGis replaced by a comma separated list of the names of the loggers you want to display, to enable displaying of the logging output from your modules: