mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-12-02 23:10:25 +01:00
fixup
This commit is contained in:
+1
-3
@@ -14,7 +14,6 @@ from dvc.stage import Stage
|
||||
from dvc.state import StateNoop
|
||||
from dvc.utils import resolve_output
|
||||
from dvc.utils.fs import remove
|
||||
from dvc.utils.fs import path_isin
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -46,8 +45,7 @@ def get(url, path, out=None, rev=None):
|
||||
try:
|
||||
with external_repo(cache_dir=tmp_dir, url=url, rev=rev) as repo:
|
||||
full_path = os.path.join(repo.root_dir, path)
|
||||
path_in_repo = path_isin(full_path, repo.root_dir)
|
||||
if os.path.exists(full_path) and path_in_repo:
|
||||
if os.path.exists(full_path) and not os.path.isabs(path):
|
||||
_copy_git_file(repo, path, out)
|
||||
return
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
||||
import filecmp
|
||||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -128,18 +127,18 @@ def test_get_full_dvc_path(erepo):
|
||||
assert filecmp.cmp(external_data, "ext_data_imported", shallow=False)
|
||||
|
||||
|
||||
def test_non_cached_output(request, erepo):
|
||||
def test_non_cached_output(tmp_path, erepo):
|
||||
os.chdir(erepo.root_dir)
|
||||
erepo.dvc.run(
|
||||
outs_no_cache=["non_cached_file"], cmd="echo hello > non_cached_file"
|
||||
)
|
||||
erepo.dvc.scm.add(["non_cached_file", "non_cached_file.dvc"])
|
||||
erepo.dvc.scm.commit("add non-cached output")
|
||||
new_dir = tempfile.mkdtemp(prefix=request.node.name + "_")
|
||||
os.chdir(new_dir)
|
||||
os.chdir(tmp_path)
|
||||
Repo.get(erepo.root_dir, "non_cached_file")
|
||||
assert os.path.isfile("non_cached_file")
|
||||
|
||||
src = os.path.join(erepo.root_dir, "non_cached_file")
|
||||
assert os.path.isfile("non_cached_file")
|
||||
assert filecmp.cmp(src, "non_cached_file", shallow=False)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user