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 — Better integration of doctest with unittest and libregrtest · Issue #108885 · python/cpython

Better integration of doctest with unittest and libregrtest #108885

New issue
Copy link
New issue
Copy link
Closed
2 / 22 of 2 issues completed
Closed
Better integration of doctest with unittest and libregrtest#108885
2 / 22 of 2 issues completed
Copy link
Assignees
serhiy-storchaka
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

Description

@serhiy-storchaka
serhiy-storchaka
opened on Sep 4, 2023
Issue body actions

Feature or enhancement

A side effect of migration to the unittest test runner (a long process finished in #89392) was the change in the output in verbose mode. In older version, when test.support.run_doctest() was used to run doctests, it outputted all doctest details when regrtests are run with -v. Now doctests are wrapped in doctest.DocTestClass and only test name is shown when regrtests are run with -v.

The former behavior was too verbose, the current behavior is too terse. I want the following behavior:

  • When regrtests are run without -v, do not output anything.
  • When regrtests are run with single -v, output only doctest name, as for other test cases.
  • When regrtests are run with -vv, output detailed doctest output.
  • Every example count as a subtest.
  • When some example fails, count it as failing subtest, and output detailed reports for every failed example. It should not include details of successful examples (except when run with -vv).
  • It would be nice to integrate it also with the unittest CLI, but taking into account that it needs two -vs to show test case names and will need three -vs to show doctest details.

It means that we should found a way to pass verbosity level to doctests and run every example within TestCase.subTest().

Linked PRs

  • gh-108885: Imporove tests for doctest #134832
  • [3.14] gh-108885: Imporove tests for doctest (GH-134832) #134855
  • [3.13] gh-108885: Imporove tests for doctest (GH-134832) #134856
  • gh-108885: Use subtests for doctest examples run by unittest #134890
  • gh-108885: Report the examples of a doctest run by unittest #155377

Activity

Next
  1. serhiy-storchaka
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Sep 4, 2023
  2. serhiy-storchaka
    added this to Unittest & doctest issueson Sep 4, 2023
  3. github-project-automation
    moved this to Todo in Unittest & doctest issueson Sep 4, 2023
  4. serhiy-storchaka
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Sep 4, 2023
  5. serhiy-storchaka
    self-assigned this
    on Sep 4, 2023
  6. serhiy-storchaka
    moved this from Todo to In Progress in Unittest & doctest issueson Sep 9, 2023
  7. serhiy-storchaka
    added 3 commits that reference this issue on May 28, 2025

    pythongh-108885: Imporove tests for doctest

    3b9b54b

    pythongh-108885: Imporove tests for doctest

    eea39c5

    gh-108885: Imporove tests for doctest (GH-134832)

    f6324bc
  8. miss-islington
    added 2 commits that reference this issue on May 28, 2025

    pythongh-108885: Imporove tests for doctest (pythonGH-134832)

    5353b43

    pythongh-108885: Imporove tests for doctest (pythonGH-134832)

    28ea9b6
  9. serhiy-storchaka
    added 2 commits that reference this issue on May 28, 2025

    [3.13] gh-108885: Imporove tests for doctest (GH-134832) (GH-134856)

    dcfb229

    [3.14] gh-108885: Imporove tests for doctest (GH-134832) (GH-134855)

    52bae91
  10. serhiy-storchaka
    added a sub-issue on May 28, 2025
    • Improved error reporting for doctests run with unittest #134857
  11. 1 remaining item

  12. serhiy-storchaka
    added a commit that references this issue on May 29, 2025

    pythongh-108885: Use subtests for doctest examples run by unittest

    55da0a1
  13. serhiy-storchaka
    added a sub-issue on May 30, 2025
    • Fix and improve doctest's documentation #134918
  14. serhiy-storchaka
    added a commit that references this issue on May 31, 2025

    gh-108885: Use subtests for doctest examples run by unittest (GH-134890

    ad39f01
  15. serhiy-storchaka commented on May 31, 2025

    @serhiy-storchaka
    serhiy-storchaka
    on May 31, 2025
    MemberAuthor
    More actions

    #134890 makes each example to be reported as a subtest, but the main goal -- control doctestі verbosity through unittest and libregrtest -- has not yet been achieved.

  16. Pranjal095
    added 2 commits that reference this issue on Jul 12, 2025

    pythongh-108885: Imporove tests for doctest (pythonGH-134832)

    847aaf7

    pythongh-108885: Use subtests for doctest examples run by unittest (p…

    21a272f
  17. taegyunkim
    added 2 commits that reference this issue on Aug 4, 2025

    pythongh-108885: Imporove tests for doctest (pythonGH-134832)

    9a5480b

    pythongh-108885: Use subtests for doctest examples run by unittest (p…

    8b2ec20
  18. gostak-dd
    added a commit that references this issue on Jun 2, 2026

    pythongh-108885: Imporove tests for doctest (pythonGH-134832)

    99e2f40
  19. icemac
    added a commit that references this issue on Jul 6, 2026

    Add support for Python 3.15 (#206)

    1757141
  20. serhiy-storchaka
    added a commit that references this issue on Aug 29, 2026

    gh-108885: Report the examples of a doctest run by unittest (GH-155377)

    55eef52
  21. serhiy-storchaka
    closed this as completedon Aug 29, 2026
  22. github-project-automation
    moved this from In Progress to Done in Unittest & doctest issueson Aug 29, 2026
  23. bmwiedemann
    added a commit that references this issue on Sep 1, 2026

    Update python-zope.testrunner to version 8.3 / rev 32 via SR 1374982

    eb182a4
  24. clin1234
    added a commit that references this issue on Sep 12, 2026

    pythongh-108885: Report the examples of a doctest run by unittest (py…

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

Metadata

Metadata

Assignees

  • @serhiy-storchaka
    serhiy-storchaka

Labels

stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

Projects

  • Unittest & doctest issues
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

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.