fix dvc-objects/data imports

This commit is contained in:
Daniele Trifirò
2022-06-10 14:07:33 +05:45
committed by skshetry
parent a3ee993739
commit 677da2b22c
36 changed files with 61 additions and 61 deletions
+4 -4
View File
@@ -38,8 +38,8 @@ from dvc.testing.test_workspace import TestAdd
from dvc.utils import LARGE_DIR_SIZE, relpath
from dvc.utils.fs import path_isin
from dvc.utils.serialize import YAMLFileCorruptedError, load_yaml
from dvc_objects.hash import file_md5
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash import file_md5
from dvc_objects.hashfile.hash_info import HashInfo
from tests.basic_env import TestDvc
from tests.utils import get_gitignore_content
@@ -380,7 +380,7 @@ class TestDoubleAddUnchanged(TestDvc):
def test_should_update_state_entry_for_file_after_add(mocker, dvc, tmp_dir):
file_md5_counter = mocker.spy(dvc_objects.hash, "file_md5")
file_md5_counter = mocker.spy(dvc_objects.hashfile.hash, "file_md5")
tmp_dir.gen("foo", "foo")
ret = main(["config", "cache.type", "copy"])
@@ -411,7 +411,7 @@ def test_should_update_state_entry_for_file_after_add(mocker, dvc, tmp_dir):
def test_should_update_state_entry_for_directory_after_add(
mocker, dvc, tmp_dir
):
file_md5_counter = mocker.spy(dvc_objects.hash, "file_md5")
file_md5_counter = mocker.spy(dvc_objects.hashfile.hash, "file_md5")
tmp_dir.gen({"data/data": "foo", "data/data_sub/sub_data": "foo"})
+3 -3
View File
@@ -14,7 +14,7 @@ from dvc.testing.test_remote import ( # noqa, pylint: disable=unused-import
)
from dvc.utils.fs import remove
from dvc_data.db.local import LocalObjectDB
from dvc_objects.db import ObjectDB
from dvc_objects.hashfile.db import ObjectDB
def test_cloud_cli(tmp_dir, dvc, remote, mocker):
@@ -149,7 +149,7 @@ def test_warn_on_outdated_stage(tmp_dir, dvc, local_remote, caplog):
def test_hash_recalculation(mocker, dvc, tmp_dir, local_remote):
tmp_dir.gen({"foo": "foo"})
test_file_md5 = mocker.spy(dvc_objects.hash, "file_md5")
test_file_md5 = mocker.spy(dvc_objects.hashfile.hash, "file_md5")
ret = main(["config", "cache.type", "hardlink"])
assert ret == 0
ret = main(["add", "foo"])
@@ -211,7 +211,7 @@ def test_verify_hashes(
remove("dir")
remove(dvc.odb.local.cache_dir)
hash_spy = mocker.spy(dvc_objects.hash, "file_md5")
hash_spy = mocker.spy(dvc_objects.hashfile.hash, "file_md5")
dvc.pull()
assert hash_spy.call_count == 0
+1 -1
View File
@@ -11,7 +11,7 @@ from dvc.repo import Repo
from dvc.testing.tmp_dir import TmpDir
from dvc.types import List
from dvc_data.stage import IgnoreInCollectedDirError
from dvc_objects.utils import get_mtime_and_size
from dvc_objects.hashfile.utils import get_mtime_and_size
def _to_pattern_info_list(str_list: List):
+1 -1
View File
@@ -6,7 +6,7 @@ import pytest
from git import GitCommandError
from dvc.exceptions import DvcException
from dvc_objects.hash import file_md5
from dvc_objects.hashfile.hash import file_md5
from tests.func.parsing.test_errors import escape_ansi
+1 -1
View File
@@ -10,7 +10,7 @@ from dvc.stage.utils import split_params_deps
from dvc.utils.fs import remove
from dvc.utils.serialize import dumps_yaml, parse_yaml_for_update
from dvc.utils.strictyaml import YAMLValidationError, make_relpath
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
from tests.func.test_run_multistage import supported_params
FS_STRUCTURE = {
+1 -1
View File
@@ -8,7 +8,7 @@ from dvc.cli import main
from dvc.odbmgr import ODBManager
from dvc.utils import relpath
from dvc_objects.errors import ObjectFormatError
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
def test_cache(tmp_dir, dvc):
+1 -1
View File
@@ -139,8 +139,8 @@ def test_upper_case_remote(tmp_dir, dvc, local_cloud):
def test_dir_hash_should_be_key_order_agnostic(tmp_dir, dvc):
from dvc_data.objects.tree import Tree
from dvc_data.stage import stage
from dvc_data.tree import Tree
tmp_dir.gen({"data": {"1": "1 content", "2": "2 content"}})
+1 -1
View File
@@ -258,7 +258,7 @@ def get_index(dvc, rev):
@pytest.mark.parametrize("rev", ["workspace", "HEAD"])
def test_used_objs(tmp_dir, scm, dvc, run_copy, rev):
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
dvc.config["core"]["autostage"] = True
tmp_dir.dvc_gen({"dir": {"subdir": {"file": "file"}}, "foo": "foo"})
+2 -2
View File
@@ -21,7 +21,7 @@ from dvc.stage.exceptions import StageFileDoesNotExistError
from dvc.utils import relpath
from dvc.utils.fs import remove
from dvc.utils.serialize import dump_yaml, load_yaml
from dvc_objects.hash import file_md5
from dvc_objects.hashfile.hash import file_md5
from tests.basic_env import TestDvc
@@ -817,7 +817,7 @@ class TestReproAllPipelines(SingleStageRun, TestDvc):
),
]
from dvc_objects.state import StateNoop
from dvc_objects.hashfile.state import StateNoop
self.dvc.state = StateNoop()
+1 -1
View File
@@ -31,7 +31,7 @@ from dvc.stage.exceptions import (
StagePathOutsideError,
)
from dvc.utils.serialize import load_yaml
from dvc_objects.hash import file_md5
from dvc_objects.hashfile.hash import file_md5
from tests.basic_env import TestDvc, TestDvcGit
+1 -1
View File
@@ -343,7 +343,7 @@ def test_stage_dir_optimization(
tmp_dir, dvc, mocker, dry_run, expected_staging_contents
):
from dvc_data import stage
from dvc_data.tree import Tree
from dvc_data.objects.tree import Tree
tmp_dir.dvc_gen(
{
+3 -3
View File
@@ -2,9 +2,9 @@ import os
import re
from dvc.repo import Repo
from dvc_objects.hash import file_md5
from dvc_objects.hash_info import HashInfo
from dvc_objects.state import State
from dvc_objects.hashfile.hash import file_md5
from dvc_objects.hashfile.hash_info import HashInfo
from dvc_objects.hashfile.state import State
def test_state(tmp_dir, dvc):
+1 -1
View File
@@ -5,8 +5,8 @@ from funcy import raiser
from dvc.cli import main
from dvc_data.stage import IgnoreInCollectedDirError
from dvc_objects.cache import DiskError
from dvc_objects.fs.base import FileSystem, RemoteMissingDepsError
from dvc_objects.hashfile.cache import DiskError
def test_state_pickle_errors_are_correctly_raised(tmp_dir, caplog, mocker):
+1 -1
View File
@@ -5,7 +5,7 @@ import pytest
from dvc.fs import LocalFileSystem
from dvc_data.db.local import LocalObjectDB
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
def test_status_download_optimization(mocker, dvc):
+3 -3
View File
@@ -2,9 +2,9 @@ from operator import itemgetter
import pytest
from dvc_data.tree import Tree, _merge
from dvc_objects.hash_info import HashInfo
from dvc_objects.meta import Meta
from dvc_data.objects.tree import Tree, _merge
from dvc_objects.hashfile.hash_info import HashInfo
from dvc_objects.hashfile.meta import Meta
@pytest.mark.parametrize(
+2 -2
View File
@@ -8,7 +8,7 @@ from dvc.config import NoRemoteError
from dvc.fs.data import DataFileSystem
from dvc.utils.fs import remove
from dvc_data.stage import stage
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
@pytest.mark.parametrize(
@@ -231,7 +231,7 @@ def test_get_hash_dir(tmp_dir, dvc, mocker):
{"dir": {"foo": "foo", "bar": "bar", "subdir": {"data": "data"}}}
)
fs = DataFileSystem(repo=dvc)
hash_file_spy = mocker.spy(dvc_objects.hash, "hash_file")
hash_file_spy = mocker.spy(dvc_objects.hashfile.hash, "hash_file")
assert fs.info("dir")["md5"] == "8761c4e9acad696bee718615e23e22db.dir"
assert not hash_file_spy.called
+2 -2
View File
@@ -7,7 +7,7 @@ import pytest
from dvc.fs.dvc import DvcFileSystem
from dvc_data.stage import stage
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
from tests.utils import clean_staging
@@ -577,7 +577,7 @@ def test_get_hash_mixed_dir(tmp_dir, scm, dvc):
def test_get_hash_dirty_file(tmp_dir, dvc):
from dvc_data import check
from dvc_objects.errors import ObjectFormatError
from dvc_objects.hash import hash_file
from dvc_objects.hashfile.hash import hash_file
tmp_dir.dvc_gen("file", "file")
file_hash_info = HashInfo("md5", "8c7dd922ad47494fc02c388e12c00eac")
+2 -2
View File
@@ -4,8 +4,8 @@ from unittest.mock import patch
from dvc.output import Output
from dvc.stage import Stage
from dvc.utils import relpath
from dvc_objects.hash_info import HashInfo
from dvc_objects.meta import Meta
from dvc_objects.hashfile.hash_info import HashInfo
from dvc_objects.hashfile.meta import Meta
from tests.basic_env import TestDvc
+1 -1
View File
@@ -3,7 +3,7 @@ import posixpath
from unittest import mock
from dvc.fs import FileSystem
from dvc_objects.db import ObjectDB
from dvc_objects.hashfile.db import ObjectDB
class _CallableOrNone:
+1 -1
View File
@@ -5,7 +5,7 @@ import pytest
from dvc.exceptions import OutputDuplicationError
from dvc.repo import NotDvcRepoError, Repo, locked
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
def test_is_dvc_internal(dvc):
@@ -8,7 +8,7 @@ from dvc.dvcfile import PIPELINE_FILE, Dvcfile
from dvc.stage import PipelineStage, create_stage
from dvc.stage.loader import StageLoader
from dvc.stage.serialize import split_params_deps
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
@pytest.fixture
@@ -11,7 +11,7 @@ from dvc.stage.serialize import (
to_single_stage_lockfile as _to_single_stage_lockfile,
)
from dvc.stage.utils import split_params_deps
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
kwargs = {"name": "something", "cmd": "command", "path": PIPELINE_FILE}
Schema = _Schema(LOCK_FILE_STAGE_SCHEMA)
+1 -1
View File
@@ -1,4 +1,4 @@
from dvc_objects.hash_info import HashInfo
from dvc_objects.hashfile.hash_info import HashInfo
def test_as_raw():