@@ -165,11 +165,16 @@ test suite, thanks to the :option:`-m` option: :program:`python -m test`. Under
165165the hood, it uses :mod: `!test.regrtest `; the call :program: `python -m
166166test.regrtest ` used in previous Python versions still works. Running the
167167script by itself automatically starts running all regression tests in the
168- :mod: `!test ` package. It does this by finding all modules in the package whose
169- name starts with ``test_ ``, importing them, and executing the function
170- :func: `test_main ` if present or loading the tests via
171- unittest.TestLoader.loadTestsFromModule if ``test_main `` does not exist. The
172- names of tests to execute may also be passed to the script. Specifying a single
168+ :mod: `!test ` package. It does this by finding modules and packages whose names
169+ start with ``test_ ``, importing each one, and loading its tests with
170+ :meth: `unittest.TestLoader.loadTestsFromModule `. The loader collects
171+ :class: `unittest.TestCase ` tests defined in the module. If the module defines
172+ ``load_tests ``, the loader calls it with that suite and runs the suite the
173+ function returns. Test packages use ``load_tests ``, often via
174+ :func: `test.support.load_package_tests `, to add tests discovered in
175+ submodules. A module-level ``test_main() `` function is not called. If a test
176+ module defines ``test_main ``, :mod: `!test.regrtest ` fails that test. The names of
177+ tests to execute may also be passed to the script. Specifying a single
173178regression test (:program: `python -m test test_spam `) will minimize output and
174179only print whether the test passed or failed.
175180
@@ -882,9 +887,11 @@ The :mod:`!test.support` module defines the following functions:
882887
883888.. function :: reap_children()
884889
885- Use this at the end of ``test_main `` whenever sub-processes are started.
886- This will help ensure that no extra children (zombies) stick around to
887- hog resources and create problems when looking for refleaks.
890+ Call this from a test's :meth: `~unittest.TestCase.setUp `,
891+ :meth: `~unittest.TestCase.tearDown `, or from ``tearDownModule `` when the
892+ test starts subprocesses. This will help ensure that no extra children
893+ (zombies) stick around to hog resources and create problems when looking
894+ for refleaks.
888895
889896
890897.. function :: get_attribute(obj, name)
0 commit comments