Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)
Clean all data, leaving schema as is

Suitable to be run before each db-aware test. This is much faster than
dropping whole schema an recreating from scratch.

        def clean_db():
    """Clean all data, leaving schema as is

    Suitable to be run before each db-aware test. This is much faster than
    dropping whole schema an recreating from scratch.
    """
    for table in reversed(db.metadata.sorted_tables):
        db.session.execute(table.delete())
        


src/s/k/skylines-HEAD/tests/conftest.py   skylines(Download)
from skylines import model, create_app, create_frontend_app
 
from tests import setup_app, setup_db, teardown_db, clean_db
from tests.data.bootstrap import bootstrap
 
    """
    with app.app_context():
        clean_db()
        yield model.db.session
        model.db.session.rollback()
    """
    with frontend_app.app_context():
        clean_db()
        bootstrap()
        yield frontend_app