summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2014-07-23 17:00:29 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2014-07-23 17:00:29 (GMT)
commitf012ba42fe54253378a2784aaf7177aa36be579a (patch)
tree44f904dd1023616f134f1e8f2cddac0185cd313e /Doc/library
parentc4c464911ab6a65a32b8b2162aa4537003efb87b (diff)
downloadcpython-f012ba42fe54253378a2784aaf7177aa36be579a.zip
cpython-f012ba42fe54253378a2784aaf7177aa36be579a.tar.gz
cpython-f012ba42fe54253378a2784aaf7177aa36be579a.tar.bz2
Issue #22002: Make full use of test discovery in test sub-packages.
Adds `load_package_tests` function to test.support, uses it in test_asyncio, test_email, test_json, test_tools, test_importlib and all test_importlib sub-packages to implement test discovery.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/test.rst17
1 files changed, 16 insertions, 1 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst
index 83026d8..7a7182a 100644
--- a/Doc/library/test.rst
+++ b/Doc/library/test.rst
@@ -461,7 +461,7 @@ The :mod:`test.support` module defines the following functions:
.. function:: make_bad_fd()
Create an invalid file descriptor by opening and closing a temporary file,
- and returning its descripor.
+ and returning its descriptor.
.. function:: import_module(name, deprecated=False)
@@ -554,6 +554,21 @@ The :mod:`test.support` module defines the following functions:
run simultaneously, which is a problem for buildbots.
+.. function:: load_package_tests(pkg_dir, loader, standard_tests, pattern)
+
+ Generic implementation of the :mod:`unittest` ``load_tests`` protocol for
+ use in test packages. *pkg_dir* is the root directory of the package;
+ *loader*, *standard_tests*, and *pattern* are the arguments expected by
+ ``load_tests``. In simple cases, the test package's ``__init__.py``
+ can be the following::
+
+ import os
+ from test.support import load_package_tests
+
+ def load_tests(*args):
+ return load_package_tests(os.path.dirname(__file__), *args)
+
+
The :mod:`test.support` module defines the following classes:
.. class:: TransientResource(exc, **kwargs)