mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Move copyfile to fs.py
This commit is contained in:
+17
-1
@@ -3,7 +3,7 @@ import stat
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.utils.fs import makedirs
|
||||
from dvc.utils.fs import makedirs, copyfile
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="Not supported for Windows.")
|
||||
@@ -18,3 +18,19 @@ def test_makedirs_permissions(tmp_dir):
|
||||
|
||||
assert stat.S_IMODE(os.stat(test_dir).st_mode) == dir_mode
|
||||
assert stat.S_IMODE(os.stat(intermediate_dir).st_mode) == dir_mode
|
||||
|
||||
|
||||
def test_copyfile(tmp_dir):
|
||||
src = "file1"
|
||||
dest = "file2"
|
||||
dest_dir = "testdir"
|
||||
|
||||
tmp_dir.gen(src, "file1contents")
|
||||
|
||||
os.mkdir(dest_dir)
|
||||
|
||||
copyfile(src, dest)
|
||||
assert (tmp_dir / dest).read_text() == "file1contents"
|
||||
|
||||
copyfile(src, dest_dir)
|
||||
assert (tmp_dir / dest_dir / src).read_text() == "file1contents"
|
||||
|
||||
Reference in New Issue
Block a user