| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
DocTestCase ran its examples with verbose=False, so there was no way to ask unittest for the details which doctest reports on its own. It now takes the verbosity from the test result, and reports every example if the test runner is asked for more than the test names. They are written to the stream of the test runner, so that they are not lost when it buffers the output of the test. To make this reachable: * unittest.TestResult has now a verbosity attribute, which it accepted but ignored. The test runner sets it, because a result class is free to filter what its constructor gets. * The unittest -v option is now counted, so that -vv means 3. * The verbosity of regrtest is one less, so it is translated where the test runner is created: -v reports the test names, as before, and -vv reports also the examples. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Documentation build overview4 files changed ± library/doctest.html ± library/test.html ± library/unittest.html ± whatsnew/changelog.html |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
DocTestCase.runTest() runs the examples with verbose=False, so there is no way to ask unittest for the details which doctest reports on its own. It now takes the verbosity from the test result, and reports every example if the test runner is asked for more than the test names.
$ ./python -m test -vv test_difflib ... get_opcodes (difflib.SequenceMatcher) Doctest: difflib.SequenceMatcher.get_opcodes ... Trying: a = "qabxcd" Expecting nothing ok ... get_opcodes (difflib.SequenceMatcher) Doctest: difflib.SequenceMatcher.get_opcodes ... okThe examples are written to the stream of the test runner, not to the standard output, so that they are not lost when the result buffers the output of the test.
Three changes make this reachable:
A counted option is relative, so -v passed twice now means 3 rather than 2, and -q -v means 1 rather than 2.
This is the only goal of the issue which is left: the quiet levels already behave as it asks, and GH-134890 made every example a subtest.