← 返回首页
gh-108794: doctest counts skipped tests by vstinner · Pull Request #108795 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-108794: doctest counts skipped tests#108795

Merged
vstinner merged 5 commits into
python:mainfrom
vstinner:doctest_skipped
Sep 2, 2023
Merged

gh-108794: doctest counts skipped tests#108795
vstinner merged 5 commits into
python:mainfrom
vstinner:doctest_skipped

Conversation

vstinner commented Sep 2, 2023
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member
  • Add 'skipped' attribute to doctest.TestResults.
  • Rename private DocTestRunner._name2ft attribute to DocTestRunner._stats.
  • Use f-string for string formatting.
  • Add some tests.

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

* Add 'skipped' attribute to doctest.TestResults. * Rename private DocTestRunner._name2ft attribute to DocTestRunner._stats. * Use f-string for string formatting. * Add some tests.

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

When a doctest.TestResults is unpacked with x, y = result, there is no backward incompatible changes. TestResults still only unpacks the first 2 members (failed and attempted).

Example: failed, attempted = result.

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

I wrote this enhancement while working on #108793 which logs the number of executed tests.

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Nice feature! A few docs nits:

Comment thread Doc/library/doctest.rst Outdated Show resolved Hide resolved
Comment thread Doc/library/doctest.rst Outdated Show resolved Hide resolved
Comment thread Lib/doctest.py Outdated Show resolved Hide resolved
Comment thread Lib/doctest.py Outdated Show resolved Hide resolved
Comment thread Lib/doctest.py Outdated Show resolved Hide resolved
Comment thread Lib/doctest.py Outdated Show resolved Hide resolved
Comment thread Lib/doctest.py Outdated Show resolved Hide resolved
Document also DocTestRunner API for statistics, document its attributes.

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

@AlexWaygood: Would you mind to review the updated PR?

I updated my PR to address your remarks. I also renamed DocTestRunner.skipped to DocTestRunner.skips for consistency with existing attributes. Sadly, DocTestRunner and TestResults have different attribute names.

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

cc @tim-one

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

A few more minor suggestions:

Comment thread Doc/library/doctest.rst Outdated Show resolved Hide resolved
Comment thread Doc/library/doctest.rst Outdated Show resolved Hide resolved
Comment thread Doc/whatsnew/3.13.rst Outdated Show resolved Hide resolved
Comment thread Misc/NEWS.d/next/Tests/2023-09-02-05-13-38.gh-issue-108794.tGHXBt.rst Outdated Show resolved Hide resolved

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

@AlexWaygood: Oh thanks, I addressed your second review. I also mentioned the addition of the skips attribute in What's New/Changelog entry.

AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Thanks!

Comment thread Doc/whatsnew/3.13.rst Outdated Show resolved Hide resolved
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
vstinner merged commit 4f9b706 into python:main Sep 2, 2023
vstinner deleted the doctest_skipped branch September 2, 2023 14:42

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

Thanks for the great review @AlexWaygood! I merged my PR.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Footer

© 2026 GitHub, Inc.