mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: get rid of path_info
Intermediate PR in removing path_info from our code base. It is completely removed from the main codebase and is still being used in tests, which will be migrated in the followups. For fs-specific simple path manipulation, we've introduced `fs.path` helper (similar to `os.path`). Fixes #6774
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
4175f9ffa4
commit
9aec8f1926
@@ -87,7 +87,7 @@ def test_import_url_to_dir(dname, tmp_dir, dvc):
|
||||
|
||||
dst = tmp_dir / dname / "file"
|
||||
|
||||
assert stage.outs[0].path_info == dst
|
||||
assert stage.outs[0].fs_path == os.fspath(dst)
|
||||
assert os.path.isdir(dname)
|
||||
assert dst.read_text() == "file content"
|
||||
|
||||
@@ -290,7 +290,10 @@ def test_import_url_to_remote_single_file(
|
||||
assert len(stage.outs) == 1
|
||||
|
||||
hash_info = stage.outs[0].hash_info
|
||||
assert local_remote.hash_to_path_info(hash_info.value).read_text() == "foo"
|
||||
with open(
|
||||
local_remote.hash_to_path(hash_info.value), encoding="utf-8"
|
||||
) as fobj:
|
||||
assert fobj.read() == "foo"
|
||||
assert stage.outs[0].meta.size == len("foo")
|
||||
|
||||
|
||||
@@ -335,7 +338,7 @@ def test_import_url_to_remote_directory(tmp_dir, dvc, workspace, local_remote):
|
||||
|
||||
hash_info = stage.outs[0].hash_info
|
||||
with open(
|
||||
local_remote.hash_to_path_info(hash_info.value), encoding="utf-8"
|
||||
local_remote.hash_to_path(hash_info.value), encoding="utf-8"
|
||||
) as stream:
|
||||
file_parts = json.load(stream)
|
||||
|
||||
@@ -347,10 +350,10 @@ def test_import_url_to_remote_directory(tmp_dir, dvc, workspace, local_remote):
|
||||
}
|
||||
|
||||
for file_part in file_parts:
|
||||
assert (
|
||||
local_remote.hash_to_path_info(file_part["md5"]).read_text()
|
||||
== file_part["relpath"]
|
||||
)
|
||||
with open(
|
||||
local_remote.hash_to_path(file_part["md5"]), encoding="utf-8"
|
||||
) as fobj:
|
||||
assert fobj.read() == file_part["relpath"]
|
||||
|
||||
|
||||
def test_import_url_to_remote_absolute(
|
||||
|
||||
Reference in New Issue
Block a user