8000 bpo-23882: Doc: Clarify unittest discovery document (GH-21560) · python/cpython@9dd018e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9dd018e

Browse files
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/`. (cherry picked from commit 5a4aa4c) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
1 parent 6e2f144 commit 9dd018e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Doc/library/unittest.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ Test modules and packages can customize test loading and discovery by through
330330
the `load_tests protocol`_.
331331

332332
.. versionchanged:: 3.4
333-
Test discovery supports :term:`namespace packages <namespace package>`.
333+
Test discovery supports :term:`namespace packages <namespace package>`
334+
for start directory. Note that you need to the top level directory too.
335+
(e.g. ``python -m unittest discover -s root/namespace -t root``).
334336

335337

336338
.. _organizing-tests:
@@ -1849,11 +1851,15 @@ Loading and running tests
18491851

18501852
.. versionchanged:: 3.4
18511853
Modules that raise :exc:`SkipTest` on import are recorded as skips,
1852-
not errors.
1853-
Discovery works for :term:`namespace packages <namespace package>`.
1854-
Paths are sorted before being imported so that execution order is
1855-
the same even if the underlying file system's ordering is not
1856-
dependent on file name.
1854+
not errors.
1855+
1856+
.. versionchanged:: 3.4
1857+
*start_dir* can be a :term:`namespace packages <namespace package>`.
1858+
1859+
.. versionchanged:: 3.4
1860+
Paths are sorted before being imported so that execution order is the
1861+
same even if the underlying file system's ordering is not dependent
1862+
on file name.
18571863

18581864
.. versionchanged:: 3.5
18591865
Found packages are now checked for ``load_tests`` regardless of

0 commit comments

Comments
 (0)
0