diff --git a/dvc/fs/hdfs.py b/dvc/fs/hdfs.py index 4270ee1cbe..a1148753d3 100644 --- a/dvc/fs/hdfs.py +++ b/dvc/fs/hdfs.py @@ -229,7 +229,7 @@ def info(self, path_info): def checksum(self, path_info): return HashInfo( - "checksum", + HashName.CHECKSUM.value, _hadoop_fs_checksum(path_info), size=self.getsize(path_info), ) diff --git a/dvc/fs/memory.py b/dvc/fs/memory.py index 84d672a408..1d11a17f97 100644 --- a/dvc/fs/memory.py +++ b/dvc/fs/memory.py @@ -15,7 +15,7 @@ def __init__(self, repo, config): self.fs = MemFS() def exists(self, path_info, use_dvcignore=True): - return self.fs.exists(path_info.path) + return self.fs.exists(path_info.fspath) def open(self, path_info, mode="r", encoding=None, **kwargs): return self.fs.open( diff --git a/dvc/fs/webhdfs.py b/dvc/fs/webhdfs.py index 4e698a4e5f..db123af6dc 100644 --- a/dvc/fs/webhdfs.py +++ b/dvc/fs/webhdfs.py @@ -127,7 +127,7 @@ def info(self, path_info): def checksum(self, path_info): return HashInfo( - HashName.CHECKSUM, + HashName.CHECKSUM.value, self.hdfs_client.checksum(path_info.path)["bytes"], size=self.hdfs_client.status(path_info.path)["length"], ) diff --git a/dvc/utils/serialize/_common.py b/dvc/utils/serialize/_common.py index 8e1a7b77e2..157cdc1768 100644 --- a/dvc/utils/serialize/_common.py +++ b/dvc/utils/serialize/_common.py @@ -39,9 +39,10 @@ class ParseError(DvcException): """Errors while parsing files""" def __init__(self, path: "AnyPath", message: str): + from dvc.path_info import URLInfo from dvc.utils import relpath - path = relpath(path) + path = path if isinstance(path, URLInfo) else relpath(path) super().__init__(f"unable to read: '{path}', {message}") diff --git a/tests/func/test_checkout.py b/tests/func/test_checkout.py index b002955071..706eb212b8 100644 --- a/tests/func/test_checkout.py +++ b/tests/func/test_checkout.py @@ -312,8 +312,8 @@ def test(self): class TestCheckoutMissingMd5InStageFile(TestRepro): def test(self): d = load_yaml(self.file1_stage) - del d[Stage.PARAM_OUTS][0][LocalFileSystem.hash_name] - del d[Stage.PARAM_DEPS][0][LocalFileSystem.hash_name] + del d[Stage.PARAM_OUTS][0][LocalFileSystem._DEFAULT_HASH] + del d[Stage.PARAM_DEPS][0][LocalFileSystem._DEFAULT_HASH] dump_yaml(self.file1_stage, d) with pytest.raises(CheckoutError): diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index 2e5cef473d..5d304a1090 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -420,8 +420,8 @@ def test_pipeline_file_target_ops(tmp_dir, dvc, run_copy, local_remote): outs = ["foo", "bar", "lorem", "ipsum", "baz", "lorem2"] - # each one's a copy of other, hence 3 - assert len(recurse_list_dir(path)) == 3 + # each one's a copy of other, hence 3 (plus odb config file) + assert len(recurse_list_dir(path)) == 4 clean(outs, dvc) assert set(dvc.pull(["dvc.yaml"])["added"]) == {"lorem2", "baz"} @@ -434,11 +434,11 @@ def test_pipeline_file_target_ops(tmp_dir, dvc, run_copy, local_remote): clean(TmpDir(path).iterdir()) dvc.push(["dvc.yaml:copy-ipsum-baz"]) - assert len(recurse_list_dir(path)) == 1 + assert len(recurse_list_dir(path)) == 2 clean(TmpDir(path).iterdir()) dvc.push(["dvc.yaml"]) - assert len(recurse_list_dir(path)) == 2 + assert len(recurse_list_dir(path)) == 3 with pytest.raises(StageNotFound): dvc.push(["dvc.yaml:StageThatDoesNotExist"]) @@ -524,7 +524,7 @@ def test_push_pull_fetch_pipeline_stages(tmp_dir, dvc, run_copy, local_remote): run_copy("foo", "bar", no_commit=True, name="copy-foo-bar") dvc.push("copy-foo-bar") - assert len(recurse_list_dir(local_remote.url)) == 1 + assert len(recurse_list_dir(local_remote.url)) == 2 # pushing everything so as we can check pull/fetch only downloads # from specified targets dvc.push() diff --git a/tests/func/test_repro.py b/tests/func/test_repro.py index 7585ed406d..4e92e107d2 100644 --- a/tests/func/test_repro.py +++ b/tests/func/test_repro.py @@ -736,8 +736,8 @@ def test(self): class TestReproMissingMd5InStageFile(TestRepro): def test(self): d = load_yaml(self.file1_stage) - del d[Stage.PARAM_OUTS][0][LocalFileSystem.hash_name] - del d[Stage.PARAM_DEPS][0][LocalFileSystem.hash_name] + del d[Stage.PARAM_OUTS][0][LocalFileSystem._DEFAULT_HASH.value] + del d[Stage.PARAM_DEPS][0][LocalFileSystem._DEFAULT_HASH.value] dump_yaml(self.file1_stage, d) stages = self.dvc.reproduce(self.file1_stage) diff --git a/tests/func/test_stage.py b/tests/func/test_stage.py index df54c74ed1..1800756894 100644 --- a/tests/func/test_stage.py +++ b/tests/func/test_stage.py @@ -55,8 +55,8 @@ def test_empty_list(): def test_list(): lst = [ - {LocalOutput.PARAM_PATH: "foo", LocalFileSystem.hash_name: "123"}, - {LocalOutput.PARAM_PATH: "bar", LocalFileSystem.hash_name: None}, + {LocalOutput.PARAM_PATH: "foo", LocalFileSystem._DEFAULT_HASH: "123"}, + {LocalOutput.PARAM_PATH: "bar", LocalFileSystem._DEFAULT_HASH: None}, {LocalOutput.PARAM_PATH: "baz"}, ] d = {Stage.PARAM_DEPS: lst}