Closed lpsinger closed 2 years ago
Might also be relevant: #100
@mhvk , since you dabble in Numpy ufuncs a lot, what do you think?
@lpsinger - In principle, would seem reasonable. Is the problem that normally possible examples in ufunc do not get run at all? I tried to go through the code but my pytest-fu is sufficiently small that I do not really understand what prevents the regular process for finding those possible doctests.
@lpsinger - In principle, would seem reasonable. Is the problem that normally possible examples in ufunc do not get run at all?
That's correct. That is exactly the limitation that pytest-doctest-ufunc works around.
OK. Would certainly seem to make sense to have it included here, then! From the quick look that I had, it seemed there was a nice test. I'm not sure it would be needed to be explicitly turned on/off, but it would be good to add a bit to the docs noting that even those docstrings will get included.
But really would be good to have the opinion of the main maintainers - as noted, I know very little about this and am thus not much use here.
@pllim, I was just about to start cribbing from this package to fix pytest-doctest-ufunc for pytest 7 (see lpsinger/pytest-doctest-ufunc#3), but since the CI provider du jour has changed, it may be less work if I just contribute this functionality to pytest-doctestplus. Would a PR to add the ufunc doctest functionality to pytest-doctestplus be seen as in scope?
The amount of the code seems really small so it seems fine to me, but I don't understand why the doctests for those functions are not discovered, and how Numpy does test those ?
Numpy has very poor coverage of their doctests generally, so don't count on that!
So, how did we end up compensating for numpy's poor doctest coverage? Perhaps numpy should take the ufunc plugin instead?
I think the goal is here to test our ufuncs! (Yes, we do have some, and pyerfa
has a lot of them)
p.s. I'm actually not sure whether numpy in the meantime has turned doctests on.
And Numpy doesn't currently maintain a pytest plugin. (Do they?)
Please take a look at migrated functionality in #174.
I wrote a small pytest plugin that is inspired by pytest-doctestplus, whose purpose is to enable doctest discovery for Numpy ufuncs: https://github.com/lpsinger/pytest-doctest-ufunc
It is used by another project of mine: https://git.ligo.org/lscsoft/ligo.skymap
The code is very similar to pytest-doctestplus because it is adapted from it. Would it be appropriate to contribute its functionality to pytest-doctestplus?