def test_8_tearDown(self): self.session.query(GeniusDevice).delete() self.session.query(GeniusEvent).delete() self.session.query(GeniusUser).delete() self.session.commit() testing.tearDown() from genius_bar.models import DBSession DBSession.remove()
def _initTestingDB(): from sqlalchemy import create_engine from genius_bar.models import DBSession, Base, BaseQuery sqlalchemy_url = "mysql+pymysql://root@localhost:3306/genius_bar_test?charset=utf8" engine = create_engine(sqlalchemy_url) DBSession.configure(bind=engine) Base.metadata.bind = engine return DBSession
def _initTestingDB(): from sqlalchemy import create_engine from genius_bar.models import ( DBSession, Base, BaseQuery, ) sqlalchemy_url = "mysql+pymysql://root@localhost:3306/genius_bar_test?charset=utf8" engine = create_engine(sqlalchemy_url) DBSession.configure(bind=engine) Base.metadata.bind = engine return DBSession
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ # sqlalchemy DBSession config = Configurator(settings=settings) sqlalchemy_url = settings["sqlalchemy_url"] engine = create_engine(sqlalchemy_url) DBSession.configure(bind=engine) Base.metadata.bind = engine config.include("pyramid_chameleon") config.add_static_view("static", "static", cache_max_age=3600) config.add_route("home", "/") config.scan() return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ #sqlalchemy DBSession config = Configurator(settings=settings) sqlalchemy_url = settings['sqlalchemy_url'] engine = create_engine(sqlalchemy_url) DBSession.configure(bind=engine) Base.metadata.bind = engine config.include('pyramid_chameleon') config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home', '/') config.scan() return config.make_wsgi_app()