From cf2fac5787fe4329267b22326efec22fe66af84b Mon Sep 17 00:00:00 2001 From: pawel Date: Tue, 24 Dec 2019 10:52:46 +0100 Subject: [PATCH] working tree: adjust walk behaviour to os.walk --- dvc/scm/tree.py | 2 +- tests/func/test_tree.py | 30 +++++------------------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/dvc/scm/tree.py b/dvc/scm/tree.py index 4deb21d25..d830397b8 100644 --- a/dvc/scm/tree.py +++ b/dvc/scm/tree.py @@ -73,7 +73,7 @@ class WorkingTree(BaseTree): raise e for root, dirs, files in dvc_walk( - os.path.abspath(top), dvcignore, topdown=topdown, onerror=onerror + top, dvcignore, topdown=topdown, onerror=onerror ): yield os.path.normpath(root), dirs, files diff --git a/tests/func/test_tree.py b/tests/func/test_tree.py index 908449fe3..d3df8528e 100644 --- a/tests/func/test_tree.py +++ b/tests/func/test_tree.py @@ -129,13 +129,7 @@ class TestWalkInNoSCM(AssertWalkEqualMixin, TestDir): tree = CleanTree(WorkingTree(self._root_dir)) self.assertWalkEqual( tree.walk(join("data_dir", "data_sub_dir")), - [ - ( - join(self._root_dir, "data_dir", "data_sub_dir"), - [], - ["data_sub"], - ) - ], + [(join("data_dir", "data_sub_dir"), [], ["data_sub"])], ) @@ -145,28 +139,14 @@ class TestWalkInGit(AssertWalkEqualMixin, TestGit): self.assertWalkEqual( tree.walk("."), [ - ( - self._root_dir, - ["data_dir"], - ["bar", "тест", "code.py", "foo"], - ), - (join(self._root_dir, "data_dir"), ["data_sub_dir"], ["data"]), - ( - join(self._root_dir, "data_dir", "data_sub_dir"), - [], - ["data_sub"], - ), + (".", ["data_dir"], ["bar", "тест", "code.py", "foo"]), + (join("data_dir"), ["data_sub_dir"], ["data"]), + (join("data_dir", "data_sub_dir"), [], ["data_sub"]), ], ) self.assertWalkEqual( tree.walk(join("data_dir", "data_sub_dir")), - [ - ( - join(self._root_dir, "data_dir", "data_sub_dir"), - [], - ["data_sub"], - ) - ], + [(join("data_dir", "data_sub_dir"), [], ["data_sub"])], ) def test_branch(self):