microsoft / picologging

An optimized logging library for Python
https://microsoft.github.io/picologging
MIT License
665 stars 22 forks source link

Make a pytest fixture for log capture #125

Open pamelafox opened 1 year ago

pamelafox commented 1 year ago

To enable easier testing in pytest, it'd be useful if we supported a fixture similar to caplog.

https://github.com/pytest-dev/pytest/blob/63d2f7f7f8ec8b09c4289f18a94178c520d93bff/src/_pytest/logging.py#L491

We can register the hook in setup.py to avoid creating a whole separate package.

cc @Goldziher for the suggestion.

pamelafox commented 1 year ago

Example pytest plugin setup.py: https://github.com/tonybaloney/pytest-azurepipelines/blob/master/setup.py