mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-28 07:18:29 +01:00
dvc: use DirInfo instead of dicts/lists (#4851)
Currently we are converting dir_info to/from lists all the time. The reason is that dir_info is stored as list of dicts in *.dir files, but that makes it hard to work with. In addition to that, we will likely be changing .dir file format in the near future #829, so we need to abstract away dir_info into something that we won't care how it will be stored on disk. Related #3256 Related #4847
This commit is contained in:
@@ -6,6 +6,7 @@ import pytest
|
||||
|
||||
from dvc.cache import Cache
|
||||
from dvc.cache.base import DirCacheError
|
||||
from dvc.dir_info import DirInfo
|
||||
from dvc.hash_info import HashInfo
|
||||
from dvc.main import main
|
||||
from dvc.utils import relpath
|
||||
@@ -60,9 +61,11 @@ class TestCacheLoadBadDirCache(TestDvc):
|
||||
self.dvc.cache.local.tree.hash_to_path_info(dir_hash)
|
||||
)
|
||||
self.create(fname, '{"a": "b"}')
|
||||
self._do_test(
|
||||
self.dvc.cache.local.load_dir_cache(HashInfo("md5", dir_hash))
|
||||
dir_info = self.dvc.cache.local.load_dir_cache(
|
||||
HashInfo("md5", dir_hash)
|
||||
)
|
||||
self.assertTrue(isinstance(dir_info, DirInfo))
|
||||
self.assertEqual(dir_info.nfiles, 0)
|
||||
|
||||
|
||||
class TestExternalCacheDir(TestDvc):
|
||||
|
||||
Reference in New Issue
Block a user