Programmatically prevent nosetests from capturing output

55 Views Asked by At

When debugging a test calling nosetests.main() in an IDE (pyCharm) no results will be shown because output is captured.

I understand that if I were calling nosetests from the command prompt I can supply the -s argument, but how do I do this programmatically so it is convenient in an IDE?

1

There are 1 best solutions below

0
Oleksiy On

You can call nose.run() instead and pass parameters, including -s, something like:

import nose
import sys

module_name = sys.modules[__name__].__file__
result = nose.run(argv=[sys.argv[0],
                        module_name,
                        '-s',
                        '--nologcapture'
                       ]
                 )