Nose: Capture script output as well as test output

If I put any print instructions at the top of my module, and not inside any class / function, nothing is printed during my test through the nose.

import os
print 'hi'
#----------------------------------------------------------------------

def make_shapes(canvas):
    """
    Generates shapes. Needs a Canvas instance to add the shapes to
    """
    params = [canvas, Colour(0, 0, 0), 1]

Placing the print inside the function works. Any ideas?

+3
source share
1 answer

Not sure if this is a problem, but you can run nosetestswith an argument -sto prevent stdout from being captured.

+6
source

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


All Articles