dvc: ignore errors on protect/set_exec (bp #5335) (#5336)

* dvc: ignore errors on protect/set_exec (#5335)

Both of these are not fatal and could safely be ignored.

Fixes #5255

(cherry picked from commit 434cd305e9)

* tests: upgrade azurite and enable loose mode

Backport of #5272

Co-authored-by: Ruslan Kuprieiev <[email protected]>
Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
mergify[bot]
2021-01-26 04:34:27 +02:00
committed by GitHub
co-authored by Ruslan Kuprieiev Ruslan Kuprieiev
parent 9638dde4da
commit 7fe0279c20
3 changed files with 10 additions and 34 deletions
+3 -19
View File
@@ -65,28 +65,12 @@ def test_is_protected(tmp_dir, dvc, link_name):
assert tree.is_protected(foo)
@pytest.mark.parametrize("err", [errno.EPERM, errno.EACCES])
def test_protect_ignore_errors(tmp_dir, mocker, err):
@pytest.mark.parametrize("err", [errno.EPERM, errno.EACCES, errno.EROFS])
def test_protect_ignore_errors(tmp_dir, dvc, mocker, err):
tmp_dir.gen("foo", "foo")
foo = PathInfo("foo")
tree = LocalTree(None, {})
tree.protect(foo)
mock_chmod = mocker.patch(
"os.chmod", side_effect=OSError(err, "something")
)
tree.protect(foo)
assert mock_chmod.called
def test_protect_ignore_erofs(tmp_dir, mocker):
tmp_dir.gen("foo", "foo")
foo = PathInfo("foo")
tree = LocalTree(None, {})
mock_chmod = mocker.patch(
"os.chmod", side_effect=OSError(errno.EROFS, "read-only fs")
)
tree.protect(foo)
LocalTree(None, {}).protect(PathInfo("foo"))
assert mock_chmod.called