mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Initial simple separation to get the process of extracting dvc-objects and dvc-data packages out of dvc. dvc-objects is for: * defining base Object (aka HashFile) and ObjectDB * providing tools to work with those objects (check/transfer/etc) * etc dvc-data is for: * defining higher level objects (e.g. Tree) * bulding objects from the workspace (aka staging) * projecting objects back into the workspace (aka checkout) * comparing Tree objects (aka diff) * defining misc object databases (e.g LocalObjectDB) * higher-level transfer (e.g. with Tree indexes) * etc For example, the objects we use in run-cache are based on dvc-objects and not on dvc-data, as they have absolutely nothing to do with data management. There are still some mixups in the code that will be addressed in the followups.
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
from dvc.data.db import ODBManager
|
|
from dvc.dvcfile import PIPELINE_FILE, PIPELINE_LOCK
|
|
from dvc.system import System
|
|
|
|
|
|
def test_destroy(tmp_dir, dvc, run_copy):
|
|
dvc.config["cache"]["type"] = ["symlink"]
|
|
dvc.odb = ODBManager(dvc)
|
|
|
|
tmp_dir.dvc_gen("file", "text")
|
|
tmp_dir.dvc_gen({"dir": {"file": "lorem", "subdir/file": "ipsum"}})
|
|
|
|
run_copy("file", "file2", single_stage=True)
|
|
run_copy("file2", "file3", name="copy-file2-file3")
|
|
run_copy("file3", "file4", name="copy-file3-file4")
|
|
|
|
dvc.destroy()
|
|
|
|
# Remove all the files related to DVC
|
|
for path in [
|
|
".dvc",
|
|
"file.dvc",
|
|
"file2.dvc",
|
|
"dir.dvc",
|
|
PIPELINE_FILE,
|
|
PIPELINE_LOCK,
|
|
]:
|
|
assert not (tmp_dir / path).exists()
|
|
|
|
# Leave the rest of the files
|
|
for path in [
|
|
"file",
|
|
"file2",
|
|
"file3",
|
|
"file4",
|
|
"dir/file",
|
|
"dir/subdir/file",
|
|
]:
|
|
assert (tmp_dir / path).is_file()
|
|
|
|
# Make sure that data was unprotected after `destroy`
|
|
for path in [
|
|
"file",
|
|
"file2",
|
|
"file3",
|
|
"file4",
|
|
"dir",
|
|
"dir/file",
|
|
"dir/subdir",
|
|
"dir/subdir/file",
|
|
]:
|
|
assert not System.is_symlink(tmp_dir / path)
|