-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Access captures logs in teardown #3117
Access captures logs in teardown #3117
Conversation
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.
Looks good as a first iteration, thanks!
Some things missing:
- A test for the new feature
- Please rebase this on the
features
branch because it is a new functionality - A new change log entry: a file
changelog/3117.feature
with a brief description of the change, from the POV of an user.
Also I think we should mention this in the documentation, in logging.rst
.
Thanks again @boxed!
I can do all that, but notice that I'll document |
@nicoddemus Changes made. |
@boxed good point! I propose we create a def get_handler(self, when):
"""..."""
return self._item.catch_log_handlers.get(when) This way we don't expose the entire |
|
||
|
||
@pytest.fixture | ||
def logging_during_setup_and_teardown(caplog): |
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.
The test looks good, thanks!
I've made the suggested change to introduce a |
I've added a little segment in the docs too... it's not the prettiest text, so suggestions are welcome! |
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.
Thanks @boxed!
This is a fix for the problem seen here: eisensheng/pytest-catchlog#37
I would like to validate some logs globally for the entire test suite. The problem is that caplog gives you one bucket of logs for the phase you're currently in, but I want to check the 'call' bucket when I'm in 'teardown'. This change makes it possible to access all the buckets from all the other.