From 9a03550b574bfcf3ee5fc8a0cce6cf3b487ff577 Mon Sep 17 00:00:00 2001 From: prd Date: Wed, 26 Feb 2020 13:14:07 +0100 Subject: [PATCH 1/2] test commit --- tests/func/test_cache.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/func/test_cache.py b/tests/func/test_cache.py index 147840ee41..f74298283c 100644 --- a/tests/func/test_cache.py +++ b/tests/func/test_cache.py @@ -204,3 +204,19 @@ def test_shared_cache(tmp_dir, dvc, protected, dir_mode, file_mode): for fname in fnames: path = os.path.join(root, fname) assert stat.S_IMODE(os.stat(path).st_mode) == file_mode + + +def test_file(tmp_dir, dvc): + (tmp_dir / "data").mkdir() + (tmp_dir / "data" / "DATA").write_text("asdfsdf") + + DATA = os.path.join("data", "DATA") + data = os.path.join("data", "data") + + from dvc.path_info import PathInfo + + assert dvc.cache.local.exists(PathInfo(DATA)) + assert not dvc.cache.local.exists(PathInfo(data)) + + assert os.path.exists(DATA) + assert not os.path.exists(data) From f9bebd0fa0296e10987d6c1045943c7244b4878b Mon Sep 17 00:00:00 2001 From: pawel Date: Tue, 3 Mar 2020 20:44:04 +0100 Subject: [PATCH 2/2] test with inodes --- tests/func/test_cache.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/func/test_cache.py b/tests/func/test_cache.py index f74298283c..e4f984221b 100644 --- a/tests/func/test_cache.py +++ b/tests/func/test_cache.py @@ -206,17 +206,16 @@ def test_shared_cache(tmp_dir, dvc, protected, dir_mode, file_mode): assert stat.S_IMODE(os.stat(path).st_mode) == file_mode -def test_file(tmp_dir, dvc): +def test_file_by_inode(tmp_dir, dvc): (tmp_dir / "data").mkdir() (tmp_dir / "data" / "DATA").write_text("asdfsdf") DATA = os.path.join("data", "DATA") data = os.path.join("data", "data") - from dvc.path_info import PathInfo + # assert dvc.cache.local.exists(PathInfo(DATA)) + # assert not dvc.cache.local.exists(PathInfo(data)) - assert dvc.cache.local.exists(PathInfo(DATA)) - assert not dvc.cache.local.exists(PathInfo(data)) + from dvc.system import System - assert os.path.exists(DATA) - assert not os.path.exists(data) + assert System.inode(DATA) == System.inode(data)