channel output in console test suite unittest

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
teobo
Posts: 405
Joined: Fri Feb 21, 2014 11:23 am

channel output in console test suite unittest

Postby teobo » Mon Mar 21, 2016 2:12 pm

Hi,
do not know, if this is rather a python question or freecad one as I need it for a freecad macro.

Consider for example this line in a tested or Test-function:

Code: Select all

Import.export([FreeCAD.activeDocument().getObject(compound.Name)], step1)
It makes some noise like this on the console:
Reading STEP file......
Now I do not know how to handle this console streams, at all. What would be a best practice to have it logged and how to keep the the console free, when I trigger the unittest from the command line often.
such as

Code: Select all

python -m unittest Testpointtopost.ReportTestCase.test_prepares_csv_visu_from_step_filelist
Practiced a little python logging, but am unsure to fit in the fc-system. Is logging needed? How?
Tia