-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-134567: Exposes log format to users in unittest.TestCase.assertLogs #134570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
@ezio-melotti @rbtcollins @gpshead @serhiy-storchaka Does anyone have any bandwidth to look a this one? I believe it will be a fairly quick either accept or reject type change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a new feature, it needs a documentation. Add a versionchanged
directive for assertLogs()
, add an entry in the What's New document.
I have no strong opinion about this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"so your assertions can match a custom format" looks misleading. It can be misinterpreted as if assertLogs()
itself checks that logging messages were formatted using the specified formatter. This is not true. assertLogs()
does not check what formatter was used for the specified logger. It uses the specified formatter (or the default one) to format logging messages in output
.
I suggest simply saying that a formatter is used to format the strings in output
.
Allows users optionally to pass a custom log formatter to assertLogs such that assertions match expected custom formats where they are used. Existing behavior should be unaffected.