summaryrefslogtreecommitdiffstats
path: root/Doc/library/unittest.rst
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2021-02-22 06:14:26 (GMT)
committerGitHub <noreply@github.com>2021-02-22 06:14:26 (GMT)
commit5a4aa4c03e27ca5007b86c9c1ee62c77ad08a120 (patch)
treede4480715bc1d9fdda2f3fd5ff087b8cd8ab519e /Doc/library/unittest.rst
parentb19855bb6ffd69a16e8b53873b19b0b04f488716 (diff)
downloadcpython-5a4aa4c03e27ca5007b86c9c1ee62c77ad08a120.zip
cpython-5a4aa4c03e27ca5007b86c9c1ee62c77ad08a120.tar.gz
cpython-5a4aa4c03e27ca5007b86c9c1ee62c77ad08a120.tar.bz2
bpo-23882: Doc: Clarify unittest discovery document (GH-21560)
Unittest discovery support namespace package as start directory. But it doesn't find namespace package in the start directory automatically. Otherwise, unittest discovery search into unexpected directories like `vendor/` or `node_modules/`.
Diffstat (limited to 'Doc/library/unittest.rst')
-rw-r--r--Doc/library/unittest.rst18
1 files changed, 12 insertions, 6 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index bb229f0..d413224 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -330,7 +330,9 @@ Test modules and packages can customize test loading and discovery by through
the `load_tests protocol`_.
.. versionchanged:: 3.4
- Test discovery supports :term:`namespace packages <namespace package>`.
+ Test discovery supports :term:`namespace packages <namespace package>`
+ for start directory. Note that you need to the top level directory too.
+ (e.g. ``python -m unittest discover -s root/namespace -t root``).
.. _organizing-tests:
@@ -1870,11 +1872,15 @@ Loading and running tests
.. versionchanged:: 3.4
Modules that raise :exc:`SkipTest` on import are recorded as skips,
- not errors.
- Discovery works for :term:`namespace packages <namespace package>`.
- Paths are sorted before being imported so that execution order is
- the same even if the underlying file system's ordering is not
- dependent on file name.
+ not errors.
+
+ .. versionchanged:: 3.4
+ *start_dir* can be a :term:`namespace packages <namespace package>`.
+
+ .. versionchanged:: 3.4
+ Paths are sorted before being imported so that execution order is the
+ same even if the underlying file system's ordering is not dependent
+ on file name.
.. versionchanged:: 3.5
Found packages are now checked for ``load_tests`` regardless of