Title: Improved error reporting for doctests run with unittest · Issue #134857 · python/cpython · GitHub
Open Graph Title: Improved error reporting for doctests run with unittest · Issue #134857 · python/cpython
X Title: Improved error reporting for doctests run with unittest · Issue #134857 · python/cpython
Description: There are several issues with error reports when doctests are wrapped in DocTestCase. When error happens during compilation or execution an example, the traceback contains several lines from doctest.py: File ... exec(compile(example.sour...
Open Graph Description: There are several issues with error reports when doctests are wrapped in DocTestCase. When error happens during compilation or execution an example, the traceback contains several lines from doctes...
X Description: There are several issues with error reports when doctests are wrapped in DocTestCase. When error happens during compilation or execution an example, the traceback contains several lines from doctes...
Opengraph URL: https://github.com/python/cpython/issues/134857
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improved error reporting for doctests run with unittest","articleBody":"There are several issues with error reports when doctests are wrapped in `DocTestCase`.\n\n* When error happens during compilation or execution an example, the traceback contains several lines from `doctest.py`:\n\n File ...\n exec(compile(example.source, filename, \"single\",\n ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n compileflags, True), test.globs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n* When the output differs, the traceback of AssertionError contains other line from `doctest.py`:\n\n Traceback (most recent call last):\n File ...\n raise self.failureException(self.format_failure(new.getvalue()))\n\n* Also, the AssertionError message contains redundant newline character.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-134858\n* gh-134903\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2025-05-28T17:40:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/134857/cpython/issues/134857"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:447b2a7b-7c89-467e-368e-5cd33f7b9236 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A64C:D3153:789597:9B738F:696B1635 |
| html-safe-nonce | 418ad2946490e352843787baaca91a581b8adcc1d105915c72d26807db84a77f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjRDOkQzMTUzOjc4OTU5Nzo5QjczOEY6Njk2QjE2MzUiLCJ2aXNpdG9yX2lkIjoiMjM2NzAzMjg1OTAzMDM4MDA1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2081bb0fd8a37d4c8f56b77fd6c1ee3c7647e5d812f7f59910782c7fedc8bcf3 |
| hovercard-subject-tag | issue:3098088304 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/134857/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1738c170d19b516112cd044a63e369fce2de431adcf57d8fed1d4ab01fb27c88/python/cpython/issues/134857 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1738c170d19b516112cd044a63e369fce2de431adcf57d8fed1d4ab01fb27c88/python/cpython/issues/134857 |
| og:image:alt | There are several issues with error reports when doctests are wrapped in DocTestCase. When error happens during compilation or execution an example, the traceback contains several lines from doctes... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | serhiy-storchaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width