Esempio n. 1
0
def test_put(clean):
    print("test_put")
    if skip_gcs["gcs"]:
        print("skipped")
        return
    init("gcs")
    TransparentPath.show_state()
    localpath = TransparentPath("chien.txt", fs_kind="local")
    remotepath = TransparentPath("chien.txt")
    localpath.touch()
    localpath.put(remotepath)
    assert localpath.is_file()
    assert remotepath.is_file()
Esempio n. 2
0
def test_cp(clean, fs_kind1, fs_kind2):
    print("test_cp", fs_kind1, fs_kind2)
    if skip_gcs[fs_kind1] or skip_gcs[fs_kind2]:
        print("skipped")
        return
    if fs_kind1 != "local":
        init(fs_kind1)
    elif fs_kind2 != "local":
        init(fs_kind2)

    path1 = TransparentPath("chien.txt", fs_kind=fs_kind1)
    path2 = TransparentPath("chien2.txt", fs_kind=fs_kind2)
    path1.touch()
    path1.cp(path2)
    assert path1.is_file()
    assert path2.is_file()
Esempio n. 3
0
def test_isfile(clean, fs_kind, path1, path2, expected):
    if skip_gcs[fs_kind]:
        print("skipped")
        return
    init(fs_kind)
    p1 = TransparentPath(path1)
    p1.touch()
    p2 = TransparentPath(path2)
    assert p2.is_file() == expected
Esempio n. 4
0
def test_touch(clean, fs_kind, path):
    if skip_gcs[fs_kind]:
        print("skipped")
        return
    init(fs_kind)

    p = TransparentPath(path)
    if p.exists():
        p.rm(ignore_kind=True)
    p.touch()
    assert p.is_file()
Esempio n. 5
0
def get_path(fs_kind):
    reload(sys.modules["transparentpath"])
    if skip_gcs[fs_kind]:
        print("skipped")
        return "skipped"
    init(fs_kind)

    pcsv = TransparentPath("chien.json")
    pcsv.rm(absent="ignore", ignore_kind=True)
    assert not pcsv.is_file()
    return pcsv
Esempio n. 6
0
def get_path(fs_kind, use_pandas, simple):
    reload(sys.modules["transparentpath"])
    if skip_gcs[fs_kind]:
        print("skipped")
        return
    init(fs_kind)

    to_add = ""
    if use_pandas:
        to_add = "_pandas"
    if not simple:
        to_add = f"{to_add}_multi"

    if fs_kind == "local":
        local_path = TransparentPath(f"tests/data/chien{to_add}.hdf5")
        phdf5 = TransparentPath(f"chien.hdf5")
        local_path.cp(phdf5)
    else:
        local_path = TransparentPath(f"tests/data/chien{to_add}.hdf5",
                                     fs_kind="local")
        phdf5 = TransparentPath(f"chien.hdf5")
        local_path.put(phdf5)
    assert phdf5.is_file()
    return phdf5