def test_table_postfix(self, Database, request): path = '/tmp/palladium.testing-{}.sqlite'.format(os.getpid()) request.addfinalizer(lambda: os.remove(path)) db = Database('sqlite:///{}'.format(path), table_postfix='fix') assert db.Property.__tablename__ == 'properties_fix' assert db.DBModel.__tablename__ == 'models_fix' assert db.DBModelChunk.__tablename__ == 'model_chunks_fix'
def test_init_poolclass_set(self, Database, request): from sqlalchemy.pool import QueuePool path = '/tmp/palladium.testing-{}.sqlite'.format(os.getpid()) request.addfinalizer(lambda: os.remove(path)) db = Database('sqlite:///{}'.format(path), poolclass=QueuePool) assert isinstance(db.engine.pool, QueuePool)
def database(self, request, Database): path = '/tmp/palladium.testing-{}.sqlite'.format(os.getpid()) request.addfinalizer(lambda: os.remove(path)) return Database('sqlite:///{}'.format(path), chunk_size=4)