diff options
| author | David Smith <smithdc@gmail.com> | 2023-06-14 19:22:48 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-08-31 07:14:58 +0200 |
| commit | 74b5074174d1749ee44df2f7ed418010a7a4ac70 (patch) | |
| tree | a533ff3b0e3db36baa991081d012d4554acbef28 /docs | |
| parent | 27b399d23531541d091886f683991e321c8fa314 (diff) | |
Fixed #34210 -- Added unittest's durations option to the test runner.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/django-admin.txt | 10 | ||||
| -rw-r--r-- | docs/releases/5.0.txt | 3 | ||||
| -rw-r--r-- | docs/topics/testing/advanced.txt | 10 |
3 files changed, 22 insertions, 1 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index cc448055f4..c3349f364b 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1559,6 +1559,16 @@ tests, which allows it to print a traceback if the interpreter crashes. Pass Outputs timings, including database setup and total run time. +.. django-admin-option:: --durations N + +.. versionadded:: 5.0 + +Shows the N slowest test cases (N=0 for all). + +.. admonition:: Python 3.12 and later + + This feature is only available for Python 3.12 and later. + ``testserver`` -------------- diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt index 28814f141f..fcb8091545 100644 --- a/docs/releases/5.0.txt +++ b/docs/releases/5.0.txt @@ -476,6 +476,9 @@ Tests * :class:`~django.test.AsyncClient` now supports the ``follow`` parameter. +* The new :option:`test --durations` option allows showing the duration of the + slowest tests on Python 3.12+. + URLs ~~~~ diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt index 14a45931ba..54b9d7d133 100644 --- a/docs/topics/testing/advanced.txt +++ b/docs/topics/testing/advanced.txt @@ -533,7 +533,7 @@ behavior. This class defines the ``run_tests()`` entry point, plus a selection of other methods that are used by ``run_tests()`` to set up, execute and tear down the test suite. -.. class:: DiscoverRunner(pattern='test*.py', top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_mode=False, debug_sql=False, parallel=0, tags=None, exclude_tags=None, test_name_patterns=None, pdb=False, buffer=False, enable_faulthandler=True, timing=True, shuffle=False, logger=None, **kwargs) +.. class:: DiscoverRunner(pattern='test*.py', top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_mode=False, debug_sql=False, parallel=0, tags=None, exclude_tags=None, test_name_patterns=None, pdb=False, buffer=False, enable_faulthandler=True, timing=True, shuffle=False, logger=None, durations=None, **kwargs) ``DiscoverRunner`` will search for tests in any file matching ``pattern``. @@ -613,6 +613,10 @@ and tear down the test suite. the console. The logger object will respect its logging level rather than the ``verbosity``. + ``durations`` will show a list of the N slowest test cases. Setting this + option to ``0`` will result in the duration for all tests being shown. + Requires Python 3.12+. + Django may, from time to time, extend the capabilities of the test runner by adding new arguments. The ``**kwargs`` declaration allows for this expansion. If you subclass ``DiscoverRunner`` or write your own test @@ -623,6 +627,10 @@ and tear down the test suite. custom arguments by calling ``parser.add_argument()`` inside the method, so that the :djadmin:`test` command will be able to use those arguments. + .. versionadded:: 5.0 + + The ``durations`` argument was added. + Attributes ~~~~~~~~~~ |
