2

I am trying to write some pytest tests for my Flask app. I'm using PonyORM. All my test pass but some teardown code is running that gives the following error. How do I manage this error? What is causing it?

    def _exit_session(exception):
        session = getattr(request, 'pony_session', None)
        if session is None:
>           raise RuntimeError('Request object lost db_session')
E           RuntimeError: Request object lost db_session

enter image description here

Both my actual tests pass, but this teardown fails. I'm not sure where the teardown is made or how to handle it.

4

0 回答 0