Hypothetically speaking, my function returns a value and has lot of print statements (maybe 100 or more).
Is there a way to run doctest
such that all the other printing work can be ignored/skipped (I am familiar with the +SKIP
directive, which is for skipping doctest
examples), i.e. when I execute my function (or run my module as a script) with doctest
s:
python mymodule.py
Or:
python -m doctest mymodule.py
I should get:
- nothing, in case of success; or
- error messages in case any test example fails;
and nothing else. Running doctest
should not give me a terminal window full of outputs / text from those print
function calls.
Please don't suggest using unit testing (e.g. unittest
) as it'll kill the essence of the question.