-
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
Does pytest-doctestplus support testcode and testoutput directives? #106
Comments
Please note that sphinx doctest extension is not the same as the pytest-doctestplus plugin. In your exampe, you need to add |
Hello @bsipocz But do you have plans to support it? Maybe you know if it is difficult to add? :) I can try if it doesn't take much time. I think code examples without |
What would need to happen for this extension to pickup the As they are pretty much introduced in the same place in Sphinx's docs (https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html), I think it would be rather intuitive to include them with this extension for pytest, too. Copying code snippets from |
I don't think we have plans to add this support, as we don't use it ourselves in the Astropy project. You can copy the |
Ah, that makes sense. I understood this was separated from the rest of the codebase to be a bit more standalone applicable for "any" pytest/Python user. For non-IPython console users (e.g. flat Python files/packages or when working in JupyterLab/notebooks), the |
I see a similar discussion upstream at readthedocs/sphinx_rtd_theme#167 . I did remember a long time ago I came across a doc that lets you toggle the |
That https://github.com/jurasofish/sphinx-toggleprompt extension is a nice workaround to be able to get the I think there is quite some overlap with the logic that's already implemented over at https://github.com/thisch/pytest-sphinx Thanks for the quick responses btw! EDIT: Still, 'natively' picking up testcode would be awesome. |
Here's a little Sphinx extension that monkeypatches pytest-doctestplus and sphinx.ext.doctest to at least get def setup(*args, **kwargs):
import doctest
import pytest_doctestplus.output_checker
import sphinx.ext.doctest
doctest.OutputChecker = pytest_doctestplus.output_checker.OutputChecker
return sphinx.ext.doctest.setup(*args, **kwargs) |
Hello.
I've just install pytest-doctestplus, so sorry, for probably stupid question.
I am written the following doc:
But when I run pytest only first test is executed.
While is is also correct way for defining tests: https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html
Regards.
The text was updated successfully, but these errors were encountered: