def before_all(context):
"""Create the context bag."""
# Change the configuration on the fly
os.environ['ENV'] = 'testing'
# Import this now because the environment variable
# should be changed before this happens.
context.app = create_app()
# Create all the tables in memory.
with context.app.app_context():
db.create_all()
# Create the test client.
context.client = context.app.test_client()
评论列表
文章目录