Created
July 7, 2018 08:31
-
-
Save FGtatsuro/53348aba74d3ee368821328e5d97138a to your computer and use it in GitHub Desktop.
Run doctest for modules including relative import statements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Relative import problem | |
# FYI: https://stackoverflow.com/questions/4047227/doctest-and-relative-imports | |
# | |
find tests -name '*.py' | \ | |
# Filtering | |
grep -v -e 'init.py' -e 'config' | \ | |
# This step may be only valid for regular package. | |
# https://www.python.org/dev/peps/pep-0420/ | |
sed -e 's|.py||g' -e 's|/|.|g' | \ # This | |
xargs -L 1 -I {} python -c 'import {}, doctest; doctest.testmod({}, verbose=True)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment