Example #1
0
def init_db():
    from quizr.models import DBSession
    from quizr.models import Base
    from sqlalchemy import create_engine
    engine = create_engine('sqlite://')
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)
    session = DBSession()
    return session
Example #2
0
def init_db():
    from quizr.models import DBSession
    from quizr.models import Base
    from sqlalchemy import create_engine
    engine = create_engine('sqlite://')
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)
    session = DBSession()
    return session
Example #3
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    db_dir = os.path.dirname(engine.url.database)
    if not os.path.exists(db_dir):
        os.makedirs(db_dir)
    DBSession.configure(bind=engine)
    Base.metadata.create_all(engine)
Example #4
0
 def tearDown(self):
     import transaction
     from quizr.models import DBSession
     transaction.abort()
     DBSession.remove()
     testing.tearDown()
Example #5
0
 def tearDown(self):
     import transaction
     from quizr.models import DBSession
     transaction.abort()
     DBSession.remove()
     testing.tearDown()