py.test to test flask register, AssertionError: Popped wrong request context

后端 未结 4 874
闹比i
闹比i 2021-01-01 15:05

I\'m using flask to do register and login:

from flask.ext.security.views import register, login

class Register(Resource):
    def post(self):
        return         


        
4条回答
  •  清歌不尽
    2021-01-01 15:52

    When your testA has a syntax error or other exceptions, the tearDown() method which does the context pop job will not be reached, so the testA's context wasn't popped correctly. Then your next test we call it testB will pop the testA's context. So, that's why you got the error AssertionError: Popped wrong request context..

    Check the error in your test code, fix it. Then the AssertionError will be gone automatically.

提交回复
热议问题