-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Feature request: Skip doctest conditionally #5273
Comments
In my patch above, I simply return an empty list from the I noticed that in the If the proposed feature and my approach make sense, I'll proceed to writing tests and documentation next. |
+0; I don't know doctest module so much. So I don't have any opinion. But it seems worthy. ping @shimizukawa |
+0. I am anxious about whether it will be too many options. |
Okay, let's go forward. Thanks, |
Note: |
@tk0miya, thanks for the note, I'll try to find time to work on this ASAP. |
…p/cleanup Ensure that `doctest_global_setup` and `doctest_global_cleanup` are executed before and after evaluating each `:skipif:` option.
Subject: Unit tests can be skipped conditionally using the
@unittest.skipIf()
decorator. A similar feature would be useful for doctests when run by Sphinx.Example use cases
The feature was also mentioned on Stack Overflow in the Sphinx doctest: conditional test skipping question.
Proposed syntax
Global setup
The code in the
doctest_global_setup
anddoctest_global_cleanup
configuration settings should be run before and after the condition. This would enable users to store complex conditions in a global variable and avoid repetition in doctest definitions.Expected results
When a
<condition>
evaluates to a true value, the test or the test output assertion should be skipped.The text was updated successfully, but these errors were encountered: