diff options
author | Robert Collins <rbtcollins@hp.com> | 2014-11-04 14:09:01 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2014-11-04 14:09:01 (GMT) |
commit | bf2bda3c9704181cebb6163f5eacd5ad4e1c15f4 (patch) | |
tree | 1f2e15056fc7e7bd965dd5b043183bc575d28f62 /Doc/library/unittest.rst | |
parent | d39e199a0d49504583c5672252f653fc01837e32 (diff) | |
download | cpython-bf2bda3c9704181cebb6163f5eacd5ad4e1c15f4.zip cpython-bf2bda3c9704181cebb6163f5eacd5ad4e1c15f4.tar.gz cpython-bf2bda3c9704181cebb6163f5eacd5ad4e1c15f4.tar.bz2 |
Close #22457: Honour load_tests in the start_dir of discovery.
We were not honouring load_tests in a package/__init__.py when that was the
start_dir parameter, though we do when it is a child package. The fix required
a little care since it introduces the possibility of infinite recursion.
Diffstat (limited to 'Doc/library/unittest.rst')
-rw-r--r-- | Doc/library/unittest.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 355e31f..341c7ac 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -1668,7 +1668,11 @@ Loading and running tests If a package (a directory containing a file named :file:`__init__.py`) is found, the package will be checked for a ``load_tests`` function. If this - exists then it will be called with *loader*, *tests*, *pattern*. + exists then it will be called + ``package.load_tests(loader, tests, pattern)``. Test discovery takes care + to ensure that a package is only checked for tests once during an + invocation, even if the load_tests function itself calls + ``loader.discover``. If ``load_tests`` exists then discovery does *not* recurse into the package, ``load_tests`` is responsible for loading all tests in the |