working tree: adjust walk behaviour to os.walk

This commit is contained in:
pawel
2019-12-30 14:19:43 +01:00
parent aa613f9e6f
commit cf2fac5787
2 changed files with 6 additions and 26 deletions
+1 -1
View File
@@ -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
+5 -25
View File
@@ -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):