Closed CarlosEduR closed 3 months ago
It looks like you're logging instances and their repr requires fetching data from a db to render. Perhaps you could log with e.g. k=str(obj)
instead of k=obj
, so that you're logging strings directly? Just a thought.
An alternative would be to control the session(s) explicitly from test, so that the sqla instances can still be rendered during test teardown.
In either case I'm not sure what the plugin could change to help here, so I'll likely close this issue unless you have something actionable that pytest-structlog
could/should do here.
Thanks for the suggestions
Python Version: 3.9.16 Platform Info: macOS-13.4.1-x86_64-i386-64bit pytest-structlog = "==0.7"
My code currently logs class objects loaded using sqlalchemy, by just adding the
log
fixture to an existing test it starts failing with the following error:Not opening it as a bug, just trying to know if there is any way to fix it on my side without changing existing logs.