-
Notifications
You must be signed in to change notification settings - Fork 37
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
support using a variable (or expression) for conditional skipping, not just a dependency #193
Comments
Having a conditional feature would be nice, I suppose we just need to converge on whether to have it as an option for the currently existing Do you have any time to work on a PR for this @jab? |
Why is doctestplus not using the built-in skipif from doctest? 🤔 |
I don't have access to code atm, but is the sphinx doctest extension the same as the built-in doctest? I would have guessed no. OTOH, we certainly support a few things from it already so it's worth comparing whether e.g. testsetup works automatically or not. |
Right, sphinx.ext.doctest is not the same as the standard library's doctest module. It's the former that provides Wonderful to hear there's interest in adding support for I took a quick look at https://github.com/astropy/pytest-doctestplus/blob/main/pytest_doctestplus/sphinx/doctestplus.py with an eye toward contributing this, but couldn't immediately see how to do it, and am not sure when I could find more time for it (recently started a new job, and have a 6-month-old at home:). Would this be pretty straightforward to add though for a core maintainer or a more experienced outside contributor to this project? Thanks for your consideration! |
I have some offline flight hours later this week to fill with a suitably standalone project, will try to have a look at this then. |
Would be nice if we can take advantage of |
General 👍 to this idea -- will be helpful for people needing to deal with the changes in how units are represented (thanks @pllim for pointing to this!). |
I went through the issue tracker and I think this exact issue has not been discussed yet:
It looks like the current support for conditional skipping is limited to checking for whether a dependency is available.[1]
But some blocks need to be skipped in other situations, e.g. when running with a too-old Python version, or under an alternative Python implementation such as PyPy.
As prior art, sphinx.ext.doctest has a
:skipif:
option that allows conditionally skipping doctest blocks using an arbitrary Python expression (e.g.:skipif: sys.version_info < (3,)
. Something like that would be perfect here.Or if it's easier, perhaps the existing
doctest-requires
directive could be expanded to accept a variable rather than a dependency name, e.g.and a
conftest.py
could define the variable in thedoctest_namespace
:Is there any interest in considering this?
Thanks!
[1] Both based on my testing as well as the README:
The text was updated successfully, but these errors were encountered: