-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Consider adding doctest.skip_if
decorator
#117364
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
Comments
There is a problem with applying this to non-test functions. We do not want to replace docstrings of library functions if doctests are skipped. Also, what is the solution for conditional skipping of module-level doctests? |
Hm, indeed. This might be a bit more complex: we can add Does not seem too hard, but it will be harder for sure.
This can be adjusted to include |
Or instead of patching the string, we can go with |
This was my idea too. I thought about making it more general and also setting other options for the whole test, but I don't see a use case for other options for now. Alternative ideas:
They are more complex changes of |
Feature or enhancement
Right now there's no way to skip the whole test / class doctest. You can only skip individual statements with
# doctest: +SKIP
This causes problems in several use-cases:
Right now we have this hack:
cpython/Lib/test/test_doctest/test_doctest.py
Lines 727 to 730 in 2e9be80
cpython/Lib/test/test_doctest/test_doctest.py
Lines 1999 to 2003 in 2e9be80
cpython/Lib/test/test_doctest/test_doctest.py
Lines 2938 to 2943 in 2e9be80
However, this is just test functions. For library functions it would be much harder to do.
You have to jiggle
__doc__
attribute around.Since #117297 we now have correct skipped count for
doctest
+unittest
integration.So, I propose adding this decorator to
doctest.py
It will allow us skipping some tests conditionally with the proper reported results.
Refs #116758
CC @serhiy-storchaka and @furkanonder
Linked PRs
doctest.SkipTest
to skip all or some doctest examples #122935The text was updated successfully, but these errors were encountered: