scipy / scipy_doctest

Floating-point aware doctesting
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Skiplist fails with duplicate items #102

Closed Sheila-nk closed 8 months ago

Sheila-nk commented 1 year ago

Currently, the DTConfig skiplist attribute effectively excludes test items from doctesting. However, it faces a limitation in SciPy where duplicate items are collected. These duplicates stem from the __all__ attribute in modules. For instance, the bspline function from scipy.signal is collected more than once:

item: bspline
dtest: <DocTest scipy.signal._bsplines.bspline from /Users/sheilakahwai/Documents/Work/scipy/build-install/lib/python3.11/site-packages/scipy/signal/_bsplines.py:160 (12 examples)>
module: <module 'scipy.signal._bsplines' from '/Users/sheilakahwai/Documents/Work/scipy/build-install/lib/python3.11/site-packages/scipy/signal/_bsplines.py'>

item: bspline
dtest: <DocTest scipy.signal.bspline from /Users/sheilakahwai/Documents/Work/scipy/build-install/lib/python3.11/site-packages/scipy/signal/_bsplines.py:160 (12 examples)>
module: <module 'scipy.signal._bsplines' from '/Users/sheilakahwai/Documents/Work/scipy/build-install/lib/python3.11/site-packages/scipy/signal/_bsplines.py'>

However, the skiplist from refguide-check currently only skips one module, specifically: scipy.signal.bspline. To skip the duplicate, it's necessary to include it in the skiplist as well.

There are other instances where modules need to be skipped twice to avoid redundancy

dt_config.skiplist = [
    'scipy.special.sinc',
    'scipy.special._basic.sinc',  # comes from numpy
    'scipy.linalg.LinAlgError',
    'scipy.linalg._misc.LinAlgError',
    'scipy.signal.bspline',
    'scipy.signal._bsplines.bspline',
    'scipy.signal.cubic',
    'scipy.signal._bsplines.cubic',
    'scipy.signal.quadratic',
    'scipy.signal._bsplines.quadratic',
]

A temporary fix is to update the skiplist to accommodate such duplicates.

However, I think we need to tighten the collection a bit more to avoid duplicates and make it more seamless.

ev-br commented 1 year ago

Agreed, let's press on with your temp workaround and revisit when we tighten up the loose ends.

ev-br commented 8 months ago

Fixed in gh-107