Merge branch 'master' into close-1652

This commit is contained in:
Mr. Outis
2019-09-05 10:47:18 -05:00
8 changed files with 51 additions and 9 deletions
+18
View File
@@ -12,6 +12,7 @@ import posixpath
import logging
import colorama
from dvc.remote import RemoteLOCAL
from dvc.system import System
from mock import patch
@@ -535,3 +536,20 @@ def test_windows_should_add_when_cache_on_different_drive(
ret = main(["add", repo_dir.DATA])
assert ret == 0
def test_readding_dir_should_not_unprotect_all(dvc_repo, repo_dir):
dvc_repo.cache.local.cache_types = ["symlink"]
dvc_repo.cache.local.protected = True
dvc_repo.add(repo_dir.DATA_DIR)
new_file = os.path.join(repo_dir.DATA_DIR, "new_file")
repo_dir.create(new_file, "new_content")
unprotect_spy = spy(RemoteLOCAL.unprotect)
with patch.object(RemoteLOCAL, "unprotect", unprotect_spy):
dvc_repo.add(repo_dir.DATA_DIR)
assert not unprotect_spy.mock.called
assert System.is_symlink(new_file)
+8
View File
@@ -1,6 +1,9 @@
import os
import filecmp
import pytest
from dvc.exceptions import UrlNotDvcRepoError
from dvc.repo import Repo
from tests.utils import trees_equal
@@ -38,3 +41,8 @@ def test_get_repo_rev(repo_dir, erepo):
assert os.path.isfile(dst)
with open(dst, "r+") as fobj:
assert fobj.read() == "branch"
def test_get_from_non_dvc_repo(git_erepo):
with pytest.raises(UrlNotDvcRepoError):
Repo.get(git_erepo.root_dir, "some_file.zip")