def createall(): """ Initialize Database and populate with seed data. """ app = create_app() with app.app_context(): db.drop_all() db.create_all() db.session.commit()
def setUp(self): self.app = create_app(testing=True) self.app_context = self.app.app_context() self.app_context.push() self.client = self.app.test_client() db.create_all()
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from flask_script import Manager, Shell, Server from flask_migrate import MigrateCommand from rodeo.app import create_app from rodeo.config import DefaultConfig from rodeo.extensions import db app = create_app(DefaultConfig) HERE = os.path.abspath(os.path.dirname(__file__)) TEST_PATH = os.path.join(HERE, 'tests') manager = Manager(app) def _make_context(): """Return context dict for a shell session so you can access app, and db by default. """ return {'app': app, 'db': db} @manager.command def test(): """Run the tests.""" import nose return nose.main()