mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-27 07:18:28 +01:00
dvc: drop cached external outputs
Fixes #9531 Docs https://github.com/iterative/dvc.org/pull/4574 Kudos @dberenbaum
This commit is contained in:
@@ -153,57 +153,6 @@ class TestImportURLVersionAware:
|
||||
assert dvc.status() == {}
|
||||
|
||||
|
||||
class TestAdd:
|
||||
@pytest.fixture
|
||||
def hash_name(self):
|
||||
pytest.skip()
|
||||
|
||||
@pytest.fixture
|
||||
def hash_value(self):
|
||||
pytest.skip()
|
||||
|
||||
@pytest.fixture
|
||||
def dir_hash_value(self):
|
||||
pytest.skip()
|
||||
|
||||
def test_add(self, tmp_dir, dvc, workspace, hash_name, hash_value):
|
||||
from dvc.stage.exceptions import StageExternalOutputsError
|
||||
|
||||
workspace.gen("file", "file")
|
||||
|
||||
with pytest.raises(StageExternalOutputsError):
|
||||
dvc.add(workspace.url)
|
||||
|
||||
dvc.add("remote://workspace/file")
|
||||
assert (tmp_dir / "file.dvc").read_text() == (
|
||||
"outs:\n"
|
||||
f"- {hash_name}: {hash_value}\n"
|
||||
" size: 4\n"
|
||||
" hash: md5\n"
|
||||
" path: remote://workspace/file\n"
|
||||
)
|
||||
assert (workspace / "file").read_text() == "file"
|
||||
assert (
|
||||
workspace / "cache" / "files" / "md5" / hash_value[:2] / hash_value[2:]
|
||||
).read_text() == "file"
|
||||
|
||||
assert dvc.status() == {}
|
||||
|
||||
# pylint: disable-next=unused-argument
|
||||
def test_add_dir(self, tmp_dir, dvc, workspace, hash_name, dir_hash_value):
|
||||
workspace.gen({"dir": {"file": "file", "subdir": {"subfile": "subfile"}}})
|
||||
|
||||
dvc.add("remote://workspace/dir")
|
||||
assert (
|
||||
workspace
|
||||
/ "cache"
|
||||
/ "files"
|
||||
/ "md5"
|
||||
/ dir_hash_value[:2]
|
||||
/ dir_hash_value[2:]
|
||||
).is_file()
|
||||
|
||||
|
||||
def match_files(fs, entries, expected):
|
||||
entries_content = {(fs.path.normpath(d["path"]), d["isdir"]) for d in entries}
|
||||
expected_content = {(fs.path.normpath(d["path"]), d["isdir"]) for d in expected}
|
||||
|
||||
Reference in New Issue
Block a user