bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)

Alo use load_tests() for adding tests.
This commit is contained in:
Serhiy Storchaka 2021-09-20 11:36:57 +03:00 committed by GitHub
parent 5e2c32e08e
commit a856364cc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 117 additions and 183 deletions

View file

@ -1,3 +1,4 @@
import doctest
import unittest
from test import support
from itertools import *
@ -2690,26 +2691,10 @@ True
__test__ = {'libreftest' : libreftest}
def test_main(verbose=None):
test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC,
RegressionTests, LengthTransparency,
SubclassWithKwargsTest, TestExamples,
TestPurePythonRoughEquivalents,
SizeofTest)
support.run_unittest(*test_classes)
def load_tests(loader, tests, pattern):
tests.addTest(doctest.DocTestSuite())
return tests
# verify reference counting
if verbose and hasattr(sys, "gettotalrefcount"):
import gc
counts = [None] * 5
for i in range(len(counts)):
support.run_unittest(*test_classes)
gc.collect()
counts[i] = sys.gettotalrefcount()
print(counts)
# doctest the examples in the library reference
support.run_doctest(sys.modules[__name__], verbose)
if __name__ == "__main__":
test_main(verbose=True)
unittest.main()