summaryrefslogtreecommitdiff
path: root/docs/topics/testing/advanced.txt
diff options
context:
space:
mode:
authorDavid Smith <smithdc@gmail.com>2023-06-14 19:22:48 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-08-31 07:14:58 +0200
commit74b5074174d1749ee44df2f7ed418010a7a4ac70 (patch)
treea533ff3b0e3db36baa991081d012d4554acbef28 /docs/topics/testing/advanced.txt
parent27b399d23531541d091886f683991e321c8fa314 (diff)
Fixed #34210 -- Added unittest's durations option to the test runner.
Diffstat (limited to 'docs/topics/testing/advanced.txt')
-rw-r--r--docs/topics/testing/advanced.txt10
1 files changed, 9 insertions, 1 deletions
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
~~~~~~~~~~