mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
experiments: preserve file permissions across tmpdir execution (#4890)
* tree: use file_mode in upload() for trees that support modes * experiments: preserve file_mode for files in the workspace * skip permissions tests on windows * LocalTree: separate chmod from protect * fix rebase issue
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
import stat
|
||||
|
||||
import pytest
|
||||
from funcy import first
|
||||
@@ -19,6 +21,18 @@ def test_new_simple(tmp_dir, scm, dvc, exp_stage, mocker):
|
||||
).read_text() == "foo: 2"
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="Not supported for Windows.")
|
||||
def test_file_permissions(tmp_dir, scm, dvc, exp_stage, mocker):
|
||||
mode = 0o755
|
||||
os.chmod(tmp_dir / "copy.py", mode)
|
||||
scm.add(["copy.py"])
|
||||
scm.commit("set exec")
|
||||
|
||||
tmp_dir.gen("params.yaml", "foo: 2")
|
||||
dvc.experiments.run(exp_stage.addressing)
|
||||
assert stat.S_IMODE(os.stat(tmp_dir / "copy.py").st_mode) == mode
|
||||
|
||||
|
||||
def test_failed_exp(tmp_dir, scm, dvc, exp_stage, mocker, caplog):
|
||||
from dvc.stage.exceptions import StageCmdFailedError
|
||||
|
||||
|
||||
Reference in New Issue
Block a user