Join GitHub today
Access captures logs in teardown #3117
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.
Looks good as a first iteration, thanks!
Some things missing:
- A test for the new feature
- Please rebase this on the
featuresbranch because it is a new functionality
- A new change log entry: a file
changelog/3117.featurewith a brief description of the change, from the POV of an user.
Also I think we should mention this in the documentation, in
Thanks again @boxed!
@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