コード例 #1
0
def tmp_chest(*args, **kwargs):
    c = Chest(*args, **kwargs)
    fn = c.path

    try:
        yield c
    finally:
        if os.path.exists(fn):
            with c.lock:
                c.drop()
        try:
            del c
        except:
            pass
コード例 #2
0
ファイル: test_core.py プロジェクト: quantopian/chest
def tmp_chest(*args, **kwargs):
    c = Chest(*args, **kwargs)
    fn = c.path

    try:
        yield c
    finally:
        if os.path.exists(fn):
            with c.lock:
                c.drop()
        try:
            del c
        except:
            pass
コード例 #3
0
def test_del_on_normal_path():
    path = '_chest_test_path'
    if os.path.exists(path):
        shutil.rmtree(path)

    c = Chest(path=path)
    c[1] = 'one'
    c.flush()

    del c
    import gc
    gc.collect()

    assert os.path.exists(path)

    c = Chest(path=path)
    c.drop()
コード例 #4
0
ファイル: test_core.py プロジェクト: quantopian/chest
def test_del_on_normal_path():
    path = '_chest_test_path'
    if os.path.exists(path):
        shutil.rmtree(path)

    c = Chest(path=path)
    c[1] = 'one'
    c.flush()

    del c
    import gc
    gc.collect()

    assert os.path.exists(path)

    c = Chest(path=path)
    c.drop()