Example #1
0
def test_isdir_mixed(tmp_dir, dvc):
    tmp_dir.gen({"dir": {"foo": "foo", "bar": "bar"}})

    dvc.add(str(tmp_dir / "dir" / "foo"))

    tree = DvcTree(dvc)
    assert tree.isdir("dir")
    assert not tree.isfile("dir")
Example #2
0
def test_isdir_isfile(tmp_dir, dvc):
    tmp_dir.gen({"datafile": "data", "datadir": {"foo": "foo", "bar": "bar"}})

    tree = DvcTree(dvc)
    assert not tree.isdir("datadir")
    assert not tree.isfile("datadir")
    assert not tree.isdir("datafile")
    assert not tree.isfile("datafile")

    dvc.add(["datadir", "datafile"])
    shutil.rmtree(fspath_py35(tmp_dir / "datadir"))
    (tmp_dir / "datafile").unlink()

    assert tree.isdir("datadir")
    assert not tree.isfile("datadir")
    assert not tree.isdir("datafile")
    assert tree.isfile("datafile")