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

Take over pytest-doctest-ufunc? #123

Closed
lpsinger opened this issue Aug 1, 2020 · 11 comments · Fixed by #174
Closed

Take over pytest-doctest-ufunc? #123

lpsinger opened this issue Aug 1, 2020 · 11 comments · Fixed by #174

Comments

@lpsinger
Copy link
Contributor

lpsinger commented Aug 1, 2020

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?

@pllim
Copy link
Contributor

pllim commented Aug 3, 2020

Might also be relevant: #100

@mhvk , since you dabble in Numpy ufuncs a lot, what do you think?

@mhvk
Copy link
Contributor

mhvk commented Aug 3, 2020

@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
Copy link
Contributor Author

lpsinger commented Aug 3, 2020

@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.

@mhvk
Copy link
Contributor

mhvk commented Aug 3, 2020

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.

@lpsinger
Copy link
Contributor Author

lpsinger commented Feb 4, 2022

@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?

@saimn
Copy link
Contributor

saimn commented Feb 4, 2022

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 ?

@mhvk
Copy link
Contributor

mhvk commented Feb 4, 2022

Numpy has very poor coverage of their doctests generally, so don't count on that!

@pllim
Copy link
Contributor

pllim commented Feb 5, 2022

So, how did we end up compensating for numpy's poor doctest coverage? Perhaps numpy should take the ufunc plugin instead?

@mhvk
Copy link
Contributor

mhvk commented Feb 5, 2022

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.

@lpsinger
Copy link
Contributor Author

lpsinger commented Feb 5, 2022

And Numpy doesn't currently maintain a pytest plugin. (Do they?)

lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 5, 2022
This absorbs the functionality of the pytest-doctest-ufunc package,
which was heavily based on pytest-doctestplus to begin with.

pytest-doctest-ufunc will be retired.

Fixes scientific-python#123.
lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 5, 2022
This absorbs the functionality of the pytest-doctest-ufunc package,
which was heavily based on pytest-doctestplus to begin with.

pytest-doctest-ufunc will be retired.

Fixes scientific-python#123.
lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 5, 2022
This absorbs the functionality of the pytest-doctest-ufunc package,
which was heavily based on pytest-doctestplus to begin with.

pytest-doctest-ufunc will be retired.

Fixes scientific-python#123.
lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 5, 2022
This absorbs the functionality of the pytest-doctest-ufunc package,
which was heavily based on pytest-doctestplus to begin with.

pytest-doctest-ufunc will be retired.

Fixes scientific-python#123.
lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 6, 2022
This absorbs the functionality of the pytest-doctest-ufunc package,
which was heavily based on pytest-doctestplus to begin with.

pytest-doctest-ufunc will be retired.

Fixes scientific-python#123.
@lpsinger
Copy link
Contributor Author

lpsinger commented Feb 7, 2022

Please take a look at migrated functionality in #174.

lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 7, 2022
This absorbs the functionality of the pytest-doctest-ufunc package,
which was heavily based on pytest-doctestplus to begin with.

pytest-doctest-ufunc will be retired.

Fixes scientific-python#123.
lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 7, 2022
This absorbs the functionality of the pytest-doctest-ufunc package,
which was heavily based on pytest-doctestplus to begin with.

pytest-doctest-ufunc will be retired.

Fixes scientific-python#123.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants