◐ Shell
clean mode source ↗

gh-108794: doctest counts skipped tests by vstinner · Pull Request #108795 · python/cpython

@vstinner

@vstinner vstinner commented

Sep 2, 2023

edited by github-actions Bot

Loading

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

@vstinner

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

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

AlexWaygood

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:

AlexWaygood

Document also DocTestRunner API for statistics, document its
attributes.

@vstinner

@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

AlexWaygood

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

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

AlexWaygood

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