mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: remove dvc.data, fix imports
This commit is contained in:
committed by
skshetry
parent
7bc98e3fb3
commit
9a2feaa4ed
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
|
||||
from dvc.data.db import get_index
|
||||
from dvc.exceptions import DownloadError, UploadError
|
||||
from dvc.fs import LocalFileSystem
|
||||
from dvc.utils.fs import remove
|
||||
from dvc_data.db import get_index
|
||||
from tests.utils import clean_staging
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import colorama
|
||||
import pytest
|
||||
|
||||
import dvc as dvc_module
|
||||
import dvc_data
|
||||
import dvc_objects
|
||||
from dvc.cli import main
|
||||
from dvc.dvcfile import DVC_FILE_SUFFIX
|
||||
@@ -103,7 +104,7 @@ def test_add_unsupported_file(dvc):
|
||||
|
||||
|
||||
def test_add_directory(tmp_dir, dvc):
|
||||
from dvc.data import load
|
||||
from dvc_data import load
|
||||
|
||||
(stage,) = tmp_dir.dvc_gen({"dir": {"file": "file"}})
|
||||
|
||||
@@ -457,7 +458,7 @@ class TestAddCommit(TestDvc):
|
||||
|
||||
def test_should_collect_dir_cache_only_once(mocker, tmp_dir, dvc):
|
||||
tmp_dir.gen({"data/data": "foo"})
|
||||
counter = mocker.spy(dvc_module.data.stage, "_stage_tree")
|
||||
counter = mocker.spy(dvc_data.stage, "_stage_tree")
|
||||
ret = main(["add", "data"])
|
||||
assert ret == 0
|
||||
assert counter.mock.call_count == 1
|
||||
@@ -881,7 +882,7 @@ def test_add_with_cache_link_error(tmp_dir, dvc, mocker, capsys):
|
||||
tmp_dir.gen("foo", "foo")
|
||||
|
||||
mocker.patch(
|
||||
"dvc.data.checkout.test_links",
|
||||
"dvc_data.checkout.test_links",
|
||||
return_value=[],
|
||||
)
|
||||
dvc.add("foo")
|
||||
|
||||
@@ -84,7 +84,7 @@ class TestCheckoutCorruptedCacheFile(TestRepro):
|
||||
|
||||
class TestCheckoutCorruptedCacheDir(TestDvc):
|
||||
def test(self):
|
||||
from dvc.data import load
|
||||
from dvc_data import load
|
||||
|
||||
# NOTE: using 'copy' so that cache and link don't have same inode
|
||||
ret = main(["config", "cache.type", "copy"])
|
||||
|
||||
@@ -7,13 +7,13 @@ from flaky.flaky_decorator import flaky
|
||||
|
||||
import dvc_objects
|
||||
from dvc.cli import main
|
||||
from dvc.data.db.local import LocalObjectDB
|
||||
from dvc.external_repo import clean_repos
|
||||
from dvc.stage.exceptions import StageNotFound
|
||||
from dvc.testing.test_remote import ( # noqa, pylint: disable=unused-import
|
||||
TestRemote,
|
||||
)
|
||||
from dvc.utils.fs import remove
|
||||
from dvc_data.db.local import LocalObjectDB
|
||||
from dvc_objects.db import ObjectDB
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ from unittest.mock import ANY
|
||||
|
||||
from scmrepo.git import Git
|
||||
|
||||
from dvc.data.stage import stage
|
||||
from dvc.data.transfer import transfer
|
||||
from dvc.external_repo import CLONES, external_repo
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.fs import makedirs, remove
|
||||
from dvc_data.stage import stage
|
||||
from dvc_data.transfer import transfer
|
||||
from tests.unit.fs.test_dvc import make_subrepo
|
||||
from tests.utils import clean_staging
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ import pytest
|
||||
from git import Repo
|
||||
|
||||
from dvc.cli import main
|
||||
from dvc.data.db.local import LocalObjectDB
|
||||
from dvc.exceptions import CollectCacheError
|
||||
from dvc.fs import LocalFileSystem
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.utils.fs import remove
|
||||
from dvc_data.db.local import LocalObjectDB
|
||||
from tests.basic_env import TestDir, TestDvcGit
|
||||
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.data.stage import IgnoreInCollectedDirError
|
||||
from dvc.ignore import DvcIgnore, DvcIgnorePatterns
|
||||
from dvc.output import OutputIsIgnoredError
|
||||
from dvc.pathspec_math import PatternInfo, merge_patterns
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ def test_import_with_no_exec(tmp_dir, dvc, erepo_dir):
|
||||
|
||||
|
||||
def test_import_with_jobs(mocker, dvc, erepo_dir):
|
||||
import dvc.data.transfer as otransfer
|
||||
import dvc_data.transfer as otransfer
|
||||
|
||||
with erepo_dir.chdir():
|
||||
erepo_dir.dvc_gen(
|
||||
|
||||
@@ -43,7 +43,7 @@ def test_cache(tmp_dir, dvc):
|
||||
|
||||
|
||||
def test_cache_load_bad_dir_cache(tmp_dir, dvc):
|
||||
from dvc.data import load
|
||||
from dvc_data import load
|
||||
|
||||
dir_hash = "123.dir"
|
||||
fname = os.fspath(dvc.odb.local.hash_to_path(dir_hash))
|
||||
|
||||
@@ -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.stage import stage
|
||||
from dvc.data.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"}})
|
||||
|
||||
@@ -150,7 +150,7 @@ def test_dir_hash_should_be_key_order_agnostic(tmp_dir, dvc):
|
||||
[{"relpath": "1", "md5": "1"}, {"relpath": "2", "md5": "2"}]
|
||||
)
|
||||
tree.digest()
|
||||
with patch("dvc.data.stage._stage_tree", return_value=(None, tree)):
|
||||
with patch("dvc_data.stage._stage_tree", return_value=(None, tree)):
|
||||
_, _, obj = stage(dvc.odb.local, path, dvc.odb.local.fs, "md5")
|
||||
hash1 = obj.hash_info
|
||||
|
||||
@@ -161,7 +161,7 @@ def test_dir_hash_should_be_key_order_agnostic(tmp_dir, dvc):
|
||||
[{"md5": "1", "relpath": "1"}, {"md5": "2", "relpath": "2"}]
|
||||
)
|
||||
tree.digest()
|
||||
with patch("dvc.data.stage._stage_tree", return_value=(None, tree)):
|
||||
with patch("dvc_data.stage._stage_tree", return_value=(None, tree)):
|
||||
_, _, obj = stage(dvc.odb.local, path, dvc.odb.local.fs, "md5")
|
||||
hash2 = obj.hash_info
|
||||
|
||||
|
||||
@@ -342,8 +342,8 @@ def test_stage_run_checkpoint(tmp_dir, dvc, mocker, checkpoint):
|
||||
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 import stage
|
||||
from dvc_data.tree import Tree
|
||||
|
||||
tmp_dir.dvc_gen(
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ import pytest
|
||||
from funcy import raiser
|
||||
|
||||
from dvc.cli import main
|
||||
from dvc.data.stage import IgnoreInCollectedDirError
|
||||
from dvc_data.stage import IgnoreInCollectedDirError
|
||||
from dvc_objects.cache import DiskError
|
||||
from dvc_objects.fs.base import FileSystem, RemoteMissingDepsError
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.data.db.local import LocalObjectDB
|
||||
from dvc.fs import LocalFileSystem
|
||||
from dvc_data.db.local import LocalObjectDB
|
||||
from dvc_objects.hash_info import HashInfo
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ def test_status_download_optimization(mocker, dvc):
|
||||
And the desired files to fetch are already on the local cache,
|
||||
Don't check the existence of the desired files on the remote cache
|
||||
"""
|
||||
from dvc.data.status import compare_status
|
||||
from dvc_data.status import compare_status
|
||||
|
||||
odb = LocalObjectDB(LocalFileSystem(), os.getcwd())
|
||||
obj_ids = {
|
||||
@@ -85,9 +85,9 @@ def test_set_exec_ignore_errors(tmp_dir, dvc, mocker, err):
|
||||
|
||||
|
||||
def test_staging_file(tmp_dir, dvc):
|
||||
from dvc.data import check
|
||||
from dvc.data.stage import stage
|
||||
from dvc.data.transfer import transfer
|
||||
from dvc_data import check
|
||||
from dvc_data.stage import stage
|
||||
from dvc_data.transfer import transfer
|
||||
|
||||
tmp_dir.gen("foo", "foo")
|
||||
fs = LocalFileSystem()
|
||||
@@ -113,9 +113,9 @@ def test_staging_file(tmp_dir, dvc):
|
||||
|
||||
|
||||
def test_staging_dir(tmp_dir, dvc):
|
||||
from dvc.data import check
|
||||
from dvc.data.stage import stage
|
||||
from dvc.data.transfer import transfer
|
||||
from dvc_data import check
|
||||
from dvc_data.stage import stage
|
||||
from dvc_data.transfer import transfer
|
||||
|
||||
tmp_dir.gen({"dir": {"foo": "foo", "bar": "bar"}})
|
||||
fs = LocalFileSystem()
|
||||
|
||||
@@ -2,7 +2,7 @@ from operator import itemgetter
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.data.tree import Tree, _merge
|
||||
from dvc_data.tree import Tree, _merge
|
||||
from dvc_objects.hash_info import HashInfo
|
||||
from dvc_objects.meta import Meta
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import pytest
|
||||
|
||||
import dvc_objects
|
||||
from dvc.config import NoRemoteError
|
||||
from dvc.data.stage import stage
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.data.stage import stage
|
||||
from dvc.fs.dvc import DvcFileSystem
|
||||
from dvc_data.stage import stage
|
||||
from dvc_objects.hash_info import HashInfo
|
||||
from tests.utils import clean_staging
|
||||
|
||||
@@ -575,7 +575,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_data import check
|
||||
from dvc_objects.errors import ObjectFormatError
|
||||
from dvc_objects.hash import hash_file
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import pytest
|
||||
from funcy import first
|
||||
|
||||
from dvc.data.db.index import ObjectDBIndex
|
||||
from dvc_data.db.index import ObjectDBIndex
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -2,8 +2,8 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.data.db import get_index
|
||||
from dvc.fs import GSFileSystem, S3FileSystem, get_cloud_fs
|
||||
from dvc_data.db import get_index
|
||||
|
||||
|
||||
def test_remote_with_hash_jobs(dvc):
|
||||
|
||||
@@ -45,8 +45,8 @@ def dump_sv(stream, metrics, delimiter=",", header=True):
|
||||
|
||||
|
||||
def clean_staging():
|
||||
from dvc.data.stage import _STAGING_MEMFS_PATH
|
||||
from dvc.fs import MemoryFileSystem
|
||||
from dvc_data.stage import _STAGING_MEMFS_PATH
|
||||
|
||||
try:
|
||||
MemoryFileSystem().fs.rm(
|
||||
|
||||
Reference in New Issue
Block a user