Exemplo n.º 1
0
def test_open_dirty_no_hash(tmp_dir, dvc):
    tmp_dir.gen("file", "file")
    (tmp_dir / "file.dvc").write_text("outs:\n- path: file\n")

    tree = DvcTree(dvc)
    with tree.open("file", "r") as fobj:
        assert fobj.read() == "file"
Exemplo n.º 2
0
def test_open_dirty_hash(tmp_dir, dvc):
    tmp_dir.dvc_gen("file", "file")
    (tmp_dir / "file").write_text("something")

    tree = DvcTree(dvc)
    with tree.open("file", "r") as fobj:
        assert fobj.read() == "something"
Exemplo n.º 3
0
def test_open(tmp_dir, dvc):
    tmp_dir.gen("foo", "foo")
    dvc.add("foo")
    (tmp_dir / "foo").unlink()

    tree = DvcTree(dvc)
    with tree.open("foo", "r") as fobj:
        assert fobj.read() == "foo"
Exemplo n.º 4
0
def test_open_in_history(tmp_dir, scm, dvc):
    tmp_dir.gen("foo", "foo")
    dvc.add("foo")
    dvc.scm.add(["foo.dvc", ".gitignore"])
    dvc.scm.commit("foo")

    tmp_dir.gen("foo", "foofoo")
    dvc.add("foo")
    dvc.scm.add(["foo.dvc", ".gitignore"])
    dvc.scm.commit("foofoo")

    for rev in dvc.brancher(revs=["HEAD~1"]):
        if rev == "workspace":
            continue

        tree = DvcTree(dvc)
        with tree.open("foo", "r") as fobj:
            assert fobj.read() == "foo"