stouputils.all_doctests package#
This module is used to run all the doctests for all the modules in a given directory.
launch_tests()- Main function to launch tests for all modules in the given directory.test_module_with_progress()- Test a module with testmod and measure the time taken with progress printing.
# Create a package whose docstring holds two tests, the second one wrong
mkdir my_package
cat > my_package/geometry.py <<'EOF'
def area(width: float, height: float) -> float:
''' Area of a rectangle.
>>> area(2, 3)
6
>>> area(2.5, 2)
5
'''
return width * height
EOF
# Run every doctest of the package
stouputils all_doctests my_package