Print expression does not work in python proboscis

We started to write our functional and unit test cases in python using the nose framework. We started learning python when writing these tests. Since there are many dependencies between our test classes / functions, we decided to use the proboscis platform over the nose to control the execution order.

We have quite a few β€œprinted” applications in our tests, and the proboscis seems to ignore them! Tests are performed in the expected order and all are tested, but they do not print our print report data to the console. Any idea what we're missing here?

BTW, we stopped deriving our classes from "unittest.TestCase" as soon as we switched to the trunk and decorated all the classes and their member functions with @test.

+4
source share
1 answer

Note According to the protocol, "unused arguments are passed along with Nose or the unittest module", so for Proboscis you should apply the following: nosetests with python run_tests.py .

As @Wooble notes in his comment, by default, nose grabs stdout and displays it only for failed tests. You can override this behavior with the nosetests -s or --nocapture :

 $ nosetests --nocapture 

Like @Wooble also mentions in his comment, I recommend using logging instead of print . Then you only need to pass the nosetests switch -l DEBUG or --debug=DEBUG , where DEBUG is replaced by a comma-separated list of registrar names that you want to display in order to enable the display of log output from your modules:

 $ nosetests --debug=your-logger-name 
+3
source

Source: https://habr.com/ru/post/1438971/


All Articles