Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest doctest collection skips C-implemented functions #99

Open
ev-br opened this issue Sep 18, 2023 · 2 comments
Open

pytest doctest collection skips C-implemented functions #99

ev-br opened this issue Sep 18, 2023 · 2 comments
Labels
enhancement New features w.r.t. the original refguide-check pytest-plugin task

Comments

@ev-br
Copy link
Member

ev-br commented Sep 18, 2023

Figure out why doctests in c-implemented functions (ufuncs in scipy.special, LinearNDInterpolator etc) are not collected by vanilla pytest doctest collection. Maybe it's something to fix on the pytest side?
We'll then be able to remove quite a few workarounds.

@ev-br ev-br added pytest-plugin enhancement New features w.r.t. the original refguide-check task labels Sep 18, 2023
@ev-br
Copy link
Member Author

ev-br commented Sep 18, 2023

Asked a question upstream: pytest-dev/pytest#11450 @Sheila-nk

@ev-br
Copy link
Member Author

ev-br commented Sep 18, 2023

Per response at pytest-dev/pytest#11450, the canonic issue over at pytest-dev is pytest-dev/pytest#11388.

For us, it needs a bit of testing because simply using inspect.isroutine is not enough:

In [42]: from scipy import special as s

In [43]: import numpy as np


In [57]: for obj in [s.erf, np.add, LinearNDInterpolator, LinearNDInterpolator.__call__]:
    ...:     print(obj, inspect.isfunction(obj), inspect.isroutine(obj), inspect.isbuilt
    ...: in(obj), inspect.isclass(obj), isinstance(obj, np.ufunc))
    ...:
<ufunc 'erf'> False False False False True
<ufunc 'add'> False False False False True
<class 'scipy.interpolate.interpnd.LinearNDInterpolator'> False False False True False
<cyfunction NDInterpolatorBase.__call__ at 0x7fa04ee17440> False True False False False

we'll need to check if an object is a routine or a class of a ufunc. Will need testing and checking the log.

EDIT: In fact, there are two separate issues here. One is indeed pytest-dev/pytest#11388; the more immediate is that the .so files are not collected via pytest_collect_file. More details are at pytest-dev/pytest#11450.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features w.r.t. the original refguide-check pytest-plugin task
Projects
None yet
Development

No branches or pull requests

1 participant