Protect doctests against old numpy versions

This commit is contained in:
Brandon Rhodes 2019-12-16 11:43:52 -05:00
parent 3f3a762baf
commit b7d7652c66
1 changed files with 7 additions and 0 deletions

View File

@ -431,6 +431,13 @@ File type NAIF/DAF and format BIG-IEEE with 15 segments:
def load_tests(loader, tests, ignore):
"""Run our main documentation as a test."""
# If we are running in CI, where we test against an old version of
# NumPy, skip the doctests since NumPy will print whitespace
# differently (and worse).
version = tuple(int(s) for s in np.__version__.split('.'))
if version < (1, 17):
return
# Python 2.6 formats floating-point numbers a bit differently and
# breaks the doctest.
if sys.version_info >= (2, 7):