mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-117294: Report DocTestCase as skipped if all examples in the doctest are skipped (GH-117297)
This commit is contained in:
parent
efcc96844e
commit
29829b58a8
7 changed files with 87 additions and 7 deletions
|
@ -2281,12 +2281,13 @@ class DocTestCase(unittest.TestCase):
|
|||
|
||||
try:
|
||||
runner.DIVIDER = "-"*70
|
||||
failures, tries = runner.run(
|
||||
test, out=new.write, clear_globs=False)
|
||||
results = runner.run(test, out=new.write, clear_globs=False)
|
||||
if results.skipped == results.attempted:
|
||||
raise unittest.SkipTest("all examples were skipped")
|
||||
finally:
|
||||
sys.stdout = old
|
||||
|
||||
if failures:
|
||||
if results.failed:
|
||||
raise self.failureException(self.format_failure(new.getvalue()))
|
||||
|
||||
def format_failure(self, err):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue