mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)
Alo use load_tests() for adding tests.
This commit is contained in:
parent
5e2c32e08e
commit
a856364cc9
17 changed files with 117 additions and 183 deletions
|
@ -128,6 +128,7 @@ consts: ('None',)
|
|||
import inspect
|
||||
import sys
|
||||
import threading
|
||||
import doctest
|
||||
import unittest
|
||||
import textwrap
|
||||
import weakref
|
||||
|
@ -136,7 +137,7 @@ try:
|
|||
import ctypes
|
||||
except ImportError:
|
||||
ctypes = None
|
||||
from test.support import (run_doctest, run_unittest, cpython_only,
|
||||
from test.support import (cpython_only,
|
||||
check_impl_detail, requires_debug_ranges,
|
||||
gc_collect)
|
||||
from test.support.script_helper import assert_python_ok
|
||||
|
@ -609,13 +610,10 @@ if check_impl_detail(cpython=True) and ctypes is not None:
|
|||
self.assertEqual(LAST_FREED, 500)
|
||||
|
||||
|
||||
def test_main(verbose=None):
|
||||
from test import test_code
|
||||
run_doctest(test_code, verbose)
|
||||
tests = [CodeTest, CodeConstsTest, CodeWeakRefTest]
|
||||
if check_impl_detail(cpython=True) and ctypes is not None:
|
||||
tests.append(CoExtra)
|
||||
run_unittest(*tests)
|
||||
def load_tests(loader, tests, pattern):
|
||||
tests.addTest(doctest.DocTestSuite())
|
||||
return tests
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue