GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-117364: Add `doctest.SkipTest` to skip all or some doctest examples by sobolevn · Pull Request #122935 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Aug 12, 2024 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I ended up with an exception instead of a decorator. Several reasons:

  1. Exception allows skipping some parts of doctest, giving more flexibility:
>>> 'is not ' + 'skipped'
'is not skipped'

>>> import doctest
>>> raise doctest.SkipTest("All examples after are skipped")

>>> 'skipped'
'not checked'
  1. It will work with testsource and other text-based features. While @skip_if decorator required real objects with attributes.
  2. The API change is simplier with an exception. It only adds one new object. While decorator required a lot of new parameters in existing functions.
  • Issue: Consider adding doctest.skip_if decorator #117364

📚 Documentation preview 📚: https://cpython-previews--122935.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sobolevn
pythongh-117364: Add doctest.SkipTest to skip all or some doctest e…
ea3e74c
…xamples
@sobolevn
sobolevn requested a review from serhiy-storchaka August 12, 2024 11:05
@bedevere-app bedevere-app Bot mentioned this pull request Aug 12, 2024
Consider adding doctest.skip_if decorator #117364
Open
@bedevere-app bedevere-app Bot added the awaiting core review label Aug 12, 2024
@sobolevn
Fix sphix directive
431acf2
@sobolevn

sobolevn commented Oct 15, 2024

Copy link
Copy Markdown
Member Author

@serhiy-storchaka friendly ping :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Oct 19, 2024

Copy link
Copy Markdown
Member

Thank you for the reminder @sobolevn.

I worked on better integration of doctests with unittests (#108885). In these plans every doctest example is counted as a subtest. Raising unittest.SkipTest only skips a single subtest, not all following subtests. This difference between unittest.SkipTest and doctest.SkipTest may be confusing. On other hand, raising unittest.SkipTest outside of a subTest() block skips the whole test. Since the line that raises doctest.SkipTest does not have an expected output or traceback, it may be not counted as example.

So I want to try to make more progress on that issue first. Than we will see how it works together and what API is better for skipping doctests.

sobolevn reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Oct 19, 2024

Copy link
Copy Markdown
Member Author

Thanks for the info, would love to see better unittest + doctest intergration. Marking this as a draft for now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
sobolevn marked this pull request as draft October 19, 2024 11:04
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 19, 2024
@github-actions

github-actions Bot commented Apr 18, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 18, 2026
@ambv

ambv commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

This PR is blocked on its author, has not been touched by a human in more than 2 years, and no longer merges cleanly. Closing to cull the number of open pull requests. Do not reopen this pull request without getting a go-ahead from a triager or core developer on gh-117364.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ambv ambv closed this Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka Awaiting requested review from serhiy-storchaka

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

stale Stale PR or inactive for long period of time.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@sobolevn @serhiy-storchaka @ambv
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.