Is there way to only perform the doctests, ignoring print function calls?
问题 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