From a0410ffe8f43d8dcfbaa261e068879698fafdca3 Mon Sep 17 00:00:00 2001 From: Daniyal Date: Fri, 19 Mar 2021 14:50:08 +0530 Subject: Refs #32552 -- Added DiscoverRunner.log() to allow customization. Thanks Carlton Gibson, Chris Jerdonek, and David Smith for reviews. --- docs/releases/4.0.txt | 3 +++ docs/topics/testing/advanced.txt | 11 +++++++++++ 2 files changed, 14 insertions(+) (limited to 'docs') diff --git a/docs/releases/4.0.txt b/docs/releases/4.0.txt index 7695ce95a2..60c449bc88 100644 --- a/docs/releases/4.0.txt +++ b/docs/releases/4.0.txt @@ -294,6 +294,9 @@ Tests * Django test runner now supports a :option:`--buffer ` option with parallel tests. +* The new :meth:`.DiscoverRunner.log` method allows customizing the way + messages are logged. + URLs ~~~~ diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt index d3903757f6..a8a63e7b57 100644 --- a/docs/topics/testing/advanced.txt +++ b/docs/topics/testing/advanced.txt @@ -705,6 +705,17 @@ Methods Computes and returns a return code based on a test suite, and the result from that test suite. +.. method:: DiscoverRunner.log(msg, level=None) + + .. versionadded:: 4.0 + + Prints to the console a message with the given integer `logging level`_ + (e.g. ``logging.DEBUG``, ``logging.INFO``, or ``logging.WARNING``), + respecting the current ``verbosity``. For example, an ``INFO`` message will + be logged if the ``verbosity`` is at least 1, and ``DEBUG`` will be logged + if it is at least 2. + +.. _`logging level`: https://docs.python.org/3/library/logging.html#levels Testing utilities ----------------- -- cgit v1.3