How to use the pypeline.DB function in Pypeline

To help you get started, we’ve selected a few Pypeline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github corbt / pypeline / test / test_pypeline.py View on Github external
def test_database_reloading(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    c1 = test_db.collection('test')
    c1.append(5)
    c1.append(6)

    c1.delete(0)

    test_db.close()

    test_db2 = DB(db_dir)
    assert test_db2.collection('test')[0] == 6
    assert len(test_db2.collection('test')) == 1
github corbt / pypeline / test / test_pypeline.py View on Github external
def test_db_creation(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    assert os.path.isdir(db_dir) == True
    assert isinstance(test_db, DB) == True
github corbt / pypeline / test / test_pypeline.py View on Github external
def db(request):
    path = tempfile.mkdtemp()
    db = DB(path, create_if_missing=True)

    def finalize():
        db.close()
        shutil.rmtree(path)

    request.addfinalizer(finalize)
    return db
github corbt / pypeline / test / test_pypeline.py View on Github external
def test_db_schema(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    test_db.close()

    test_levelDB = plyvel.DB(db_dir)
    assert json.loads(test_levelDB.get(b'pypeline-schema-version').decode()) == schema_version
github corbt / pypeline / test / test_pypeline.py View on Github external
def collection(request):
    path = tempfile.mkdtemp()
    db = DB(path, create_if_missing=True)

    collection = db.collection('test')

    def finalize():
        db.close()
        shutil.rmtree(path)

    request.addfinalizer(finalize)
    return collection
github corbt / pypeline / test / test_pypeline.py View on Github external
def test_database_reloading(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    c1 = test_db.collection('test')
    c1.append(5)
    c1.append(6)

    c1.delete(0)

    test_db.close()

    test_db2 = DB(db_dir)
    assert test_db2.collection('test')[0] == 6
    assert len(test_db2.collection('test')) == 1