Currently, a bad logging call, e.g.
logger.info('oops', 'first', 2)
triggers the default logging handling, which is printing an error to
stderr but otherwise continuing.
For regular programs this behavior makes sense, a bad log message
shouldn't take down the program. But during tests, it is better not to
skip over such mistakes, but propagate them to the user.
11 lines
519 B
ReStructuredText
11 lines
519 B
ReStructuredText
If an error is encountered while formatting the message in a logging call, for
|
|
example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is
|
|
missing), pytest now propagates the error, likely causing the test to fail.
|
|
|
|
Previously, such a mistake would cause an error to be printed to stderr, which
|
|
is not displayed by default for passing tests. This change makes the mistake
|
|
visible during testing.
|
|
|
|
You may supress this behavior temporarily or permanently by setting
|
|
``logging.raiseExceptions = False``.
|