Commit c3b0de4e authored by R David Murray's avatar R David Murray

whatsnew: unittest discover works on namespace packages (#17457).

I also added the docs that never got committed, editing the patch provided by
Claudiu.

I collapsed the now three versionchanged directives for discovery into one.  I
tried several different styles for this.  The most obvious is a bulleted list,
but currently the only way I could find to produce that is to have *something*
appear on the versionchanged line after the colon, which combined with the
blank space before the bulleted list just looks wrong.  I also tried the
current single-line-three-sentences version with bullet characters before each
sentence, and I almost went with that as it made it clear that the three
sentences are independent.  But I decided to just go with the sentences for
simplicity reasons.
parent b261f4da
...@@ -239,9 +239,10 @@ Test Discovery ...@@ -239,9 +239,10 @@ Test Discovery
Unittest supports simple test discovery. In order to be compatible with test Unittest supports simple test discovery. In order to be compatible with test
discovery, all of the test files must be :ref:`modules <tut-modules>` or discovery, all of the test files must be :ref:`modules <tut-modules>` or
:ref:`packages <tut-packages>` importable from the top-level directory of :ref:`packages <tut-packages>` (including :term:`namespace packages
the project (this means that their filenames must be valid <namespace package>`) importable from the top-level directory of
:ref:`identifiers <identifiers>`). the project (this means that their filenames must be valid :ref:`identifiers
<identifiers>`).
Test discovery is implemented in :meth:`TestLoader.discover`, but can also be Test discovery is implemented in :meth:`TestLoader.discover`, but can also be
used from the command line. The basic command-line usage is:: used from the command line. The basic command-line usage is::
...@@ -306,6 +307,9 @@ as the start directory. ...@@ -306,6 +307,9 @@ as the start directory.
Test modules and packages can customize test loading and discovery by through Test modules and packages can customize test loading and discovery by through
the `load_tests protocol`_. the `load_tests protocol`_.
.. versionchanged:: 3.4
Test discovery supports :term:`namespace packages <namespace package>`.
.. _organizing-tests: .. _organizing-tests:
...@@ -1655,11 +1659,10 @@ Loading and running tests ...@@ -1655,11 +1659,10 @@ Loading and running tests
.. versionchanged:: 3.4 .. versionchanged:: 3.4
Modules that raise :exc:`SkipTest` on import are recorded as skips, Modules that raise :exc:`SkipTest` on import are recorded as skips,
not errors. not errors.
Discovery works for :term:`namespace packages <namespace package>`.
.. versionchanged:: 3.4 Paths are sorted before being imported so that execution order is
Paths are sorted before being imported to ensure execution order for a the same even if the underlying file system's ordering is not
given test suite is the same even if the underlying file system's ordering dependent on file name.
is not dependent on file name like in ext3/4.
The following attributes of a :class:`TestLoader` can be configured either by The following attributes of a :class:`TestLoader` can be configured either by
......
...@@ -1355,6 +1355,9 @@ context manager can be queried for the :class:`~logging.LogRecord`\ s and/or ...@@ -1355,6 +1355,9 @@ context manager can be queried for the :class:`~logging.LogRecord`\ s and/or
formatted messages that were logged. (Contributed by Antoine Pitrou in formatted messages that were logged. (Contributed by Antoine Pitrou in
:issue:`18937`.) :issue:`18937`.)
Test discovery now works with namespace packages (Contributed by Claudiu Popa
in :issue:`17457`.)
venv venv
---- ----
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment