summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_generators.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-09-20 08:36:57 (GMT)
committerGitHub <noreply@github.com>2021-09-20 08:36:57 (GMT)
commita856364cc920d8b16750fd1fadc902efb509754c (patch)
tree1f5f618d8ad0e18fd8718bc8cfaf478cd26280be /Lib/test/test_generators.py
parent5e2c32e08ed77081cabd9d51f0589f81c1572732 (diff)
downloadcpython-a856364cc920d8b16750fd1fadc902efb509754c.zip
cpython-a856364cc920d8b16750fd1fadc902efb509754c.tar.gz
cpython-a856364cc920d8b16750fd1fadc902efb509754c.tar.bz2
bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)
Alo use load_tests() for adding tests.
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r--Lib/test/test_generators.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index d14c757..433204b 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -2,6 +2,7 @@ import copy
import gc
import pickle
import sys
+import doctest
import unittest
import weakref
import inspect
@@ -2371,15 +2372,10 @@ __test__ = {"tut": tutorial_tests,
"refleaks": refleaks_tests,
}
-# Magic test name that regrtest.py invokes *after* importing this module.
-# This worms around a bootstrap problem.
-# Note that doctest and regrtest both look in sys.argv for a "-v" argument,
-# so this works as expected in both ways of running regrtest.
-def test_main(verbose=None):
- from test import support, test_generators
- support.run_unittest(__name__)
- support.run_doctest(test_generators, verbose)
+def load_tests(loader, tests, pattern):
+ tests.addTest(doctest.DocTestSuite())
+ return tests
+
-# This part isn't needed for regrtest, but for running the test directly.
if __name__ == "__main__":
- test_main(1)
+ unittest.main()