Ejemplo n.º 1
0
def sqlalchemy_setup(db_uri):
    engine = create_engine(db_uri)
    init_sqlalchemy(engine)

    sqlalchemy_patcher = mock.patch("pyramid_sqlalchemy.includeme", includeme_test)
    sqlalchemy_patcher.start()

    return SQLAlchemyTestContext(engine, sqlalchemy_patcher)
Ejemplo n.º 2
0
def sqlalchemy_setup(db_uri):
    engine = create_engine(db_uri)
    init_sqlalchemy(engine)

    sqlalchemy_patcher = mock.patch('pyramid_sqlalchemy.includeme',
                                    includeme_test)
    sqlalchemy_patcher.start()

    return SQLAlchemyTestContext(engine, sqlalchemy_patcher)
Ejemplo n.º 3
0
 def setUp(self):
     self.engine = create_engine(self.db_uri)
     if self.engine.dialect.name == 'sqlite':
         self.engine.execute('PRAGMA foreign_keys = ON')
     init_sqlalchemy(self.engine)
     if self.create_tables:
         metadata.create_all()
     super(DatabaseTestCase, self).setUp()
     self._sqlalchemy_patcher = mock.patch('pyramid_sqlalchemy.includeme')
     self._sqlalchemy_patcher.start()
Ejemplo n.º 4
0
def main(argv=sys.argv):
    if len(argv) < 2:
        usage(argv)
    config_uri = argv[1]
    options = parse_vars(argv[2:])
    setup_logging(config_uri)
    settings = get_appsettings(config_uri, options=options)
    engine = engine_from_config(settings, 'sqlalchemy.')
    init_sqlalchemy(engine)

    BaseObject.metadata.create_all()
Ejemplo n.º 5
0
 def test_basic_sqlite(self):
     engine = create_engine('sqlite://')
     init_sqlalchemy(engine)
     self.assertTrue(Session.session_factory.kw['bind'] is engine)
Ejemplo n.º 6
0
 def test_basic_sqlite(self):
     engine = create_engine('sqlite://')
     init_sqlalchemy(engine)
     self.assertTrue(Session.session_factory.kw['bind'] is engine)