From 28617cb03678fa150a41694ff15758e34965f8b5 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 20 Jul 2020 18:11:24 +0900 Subject: [PATCH] bpo-23882: Doc: Clarify unittest discovery document 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/`. --- Doc/library/unittest.rst | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 0dddbd25d991b5..15027c0dda9bfb 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 `. + Test discovery supports :term:`namespace packages ` + 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: @@ -1869,11 +1871,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 `. - 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 `. + + .. 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