mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
This moves get_fs_config/get_fs_cloud and ODBManager to DVC as they require DVC related utilities, and we don't need them strictly in dvc-objects/dvc-data. This also adds support to ReferenceHashFile to load from any filesystem, using it's module name and filename. Now we can get rid of DVCFileSystem dependency in ReferenceHashFile. This is a temporary solution, we really need a registry. (I am not quite sure if this works in pyinstaller mode, but I think it should, it's how fsspec does it if I understand correctly.)
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
from dvc.dvcfile import PIPELINE_FILE, PIPELINE_LOCK
|
|
from dvc.fs import system
|
|
from dvc.odbmgr import ODBManager
|
|
|
|
|
|
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",
|
|
".dvcignore",
|
|
"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)
|