RuntimeError: working outside of application context

Flask has an Application Context, and it seems like you’ll need to do something like:

def test_connection(self):
    with app.app_context():
        #test code

You can probably also shove the app.app_context() call into a test setup method as well. Hope this helps.

Leave a Comment