Running Single Flask Unittest Passes but Running All Tests Gives AssertionError Running Single Flask Unittest Passes but Running All Tests Gives AssertionError flask flask

Running Single Flask Unittest Passes but Running All Tests Gives AssertionError


Figured it out:

I have to move the line api = Api(prefix='/api/v0') into the function create_app and moved the add_resource functions into create_app as well:

def create_app(config_filemane):  flask_app = Flask(__name__)  ...  api = Api(prefix='/api/v0')  api.add_resource(UserListAPI, '/users', endpoint='users')  api.add_resource(UserAPI, '/users/<id>', endpoint='user')  ...  return flask_app

The api object is no longer global but I don't think I'll need to elsewhere.