dvc.stage.cache: fix typo, was using src filesystem to transfer

This was working for LocalFileSystem as they work for any directories/path.
It's hard to test this these days, as we don't have remote tests inside
dvc, so it was not caught.

Potentially fixes #7718.
This commit is contained in:
Saugat Pachhai (सौगात)
2022-05-23 16:37:40 +03:00
committed by Ruslan Kuprieiev
parent 60cbcec399
commit 942a080567
2 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -216,7 +216,7 @@ class StageCache:
from dvc.fs.callbacks import Callback
from_fs = from_odb.fs
to_fs = from_odb.fs
to_fs = to_odb.fs
func = _log_exceptions(fs.generic.copy)
runs = from_fs.path.join(from_odb.fs_path, "runs")
+19
View File
@@ -0,0 +1,19 @@
import shutil
from .tmp_dir import TmpDir
def test_push_pull(tmp_dir, dvc, remote):
tmp_dir.gen("foo", "foo")
stage = dvc.stage.add(
deps=["foo"], outs=["bar"], name="copy-foo-bar", cmd="cp foo bar"
)
dvc.reproduce(stage.addressing)
assert dvc.push(run_cache=True) == 2
stage_cache_dir = TmpDir(dvc.stage_cache.cache_dir)
expected = list(stage_cache_dir.rglob("*"))
shutil.rmtree(stage_cache_dir)
dvc.pull(run_cache=True)
assert list(stage_cache_dir.rglob("*")) == expected