Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Sep 2, 2023

  • 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
Copy link
Member Author

vstinner commented Sep 2, 2023

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
Copy link
Member Author

vstinner commented Sep 2, 2023

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

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice feature! A few docs nits:

Document also DocTestRunner API for statistics, document its attributes.
@vstinner
Copy link
Member Author

vstinner commented Sep 2, 2023

@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
Copy link
Member Author

vstinner commented Sep 2, 2023

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

A few more minor suggestions:

@vstinner
Copy link
Member Author

vstinner commented Sep 2, 2023

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

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks!

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@vstinner vstinner merged commit 4f9b706 into python:main Sep 2, 2023
@vstinner vstinner deleted the doctest_skipped branch September 2, 2023 14:42
@vstinner
Copy link
Member Author

vstinner commented Sep 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants