You can pass in optionflags
to the testmod
method, but this requires you to run the module itself instead of the doctest
module:
def foo():
"""
>>> foo()
hello ...
"""
print("hello world")
if __name__ == "__main__":
import doctest
doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
Output:
$ python foo.py
Trying:
foo()
Expecting:
hello ...
ok
1 items had no tests:
__main__
1 items passed all tests:
1 tests in __main__.foo
1 tests in 2 items.
1 passed and 0 failed.
Test passed.