[Python Wpg] Prescribed way to run doctest on all modules in many packages

Sydney Weidman syd at plug.ca
Thu Oct 4 16:31:44 EDT 2007


I was wondering if any doctest experts out there have a "clever" way to
run doctests in all modules in a given set of packages. Currently I'm
doing this:

"""
rundoctest.py: run all doctests in a directory
"""
import doctest
from glob import glob

def _test():
    for f in glob('*.py'):
        doctest.testfile(f, optionflags=doctest.ELLIPSIS)

if __name__ == '__main__':

    _test()

which is terse, but seems clumsy, since I have to have one of these
"rundoctest.py" things in every package. Any suggestions?

Thanks in advance!

- Syd





More information about the Winnipeg mailing list