bpo-45229: Make doctest tests discoverable (GH-28986)

This commit is contained in:
Serhiy Storchaka 2021-10-20 17:36:27 +03:00 committed by GitHub
parent a774285e7d
commit 8d6740f489
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 23 deletions

View file

@ -3114,20 +3114,11 @@ def test_no_trailing_whitespace_stripping():
patches that contain trailing whitespace. More info on Issue 24746.
"""
######################################################################
## Main
######################################################################
def test_main():
# Check the doctest cases in doctest itself:
ret = support.run_doctest(doctest, verbosity=True)
# Check the doctest cases defined here:
from test import test_doctest
support.run_doctest(test_doctest, verbosity=True)
# Run unittests
support.run_unittest(__name__)
def load_tests(loader, tests, pattern):
tests.addTest(doctest.DocTestSuite(doctest))
tests.addTest(doctest.DocTestSuite())
return tests
def test_coverage(coverdir):
@ -3140,8 +3131,9 @@ def test_coverage(coverdir):
r.write_results(show_missing=True, summary=True,
coverdir=coverdir)
if __name__ == '__main__':
if '-c' in sys.argv:
test_coverage('/tmp/doctest.cover')
else:
test_main()
unittest.main()