Pytest does not capture teardown logs if a fixture throws an exception #12203
Labels
plugin: logging
related to the logging builtin plugin
topic: fixtures
anything involving fixtures directly or indirectly
I have a pyest plugin (https://github.com/dcermak/pytest_container) that provides multiple fixtures which perform some heavy lifting (container launching). The plugin performs roughly the following action in the fixtures (simplified version, the actual implementation is here: https://github.com/dcermak/pytest_container/blob/c7f1623da7947c53768dd49f1a440a525e02948d/pytest_container/plugin.py#L67):
However, pytest does not capture the log output from my plugin if an exception is actually thrown. It does capture stdout, but I would prefer to be able to use the logger for everything for the sake of consistency.
pip list
pytest & os version
pytest 8.1.1
Fedora 39
pip list
from the virtual environment you are usingThe text was updated successfully, but these errors were encountered: