Skip to content

Commit

Permalink
fix windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed May 20, 2020
1 parent 821c507 commit 4082dd2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
26 changes: 14 additions & 12 deletions tests/unit/repo/test_repo_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

from dvc.path_info import PathInfo
from dvc.repo.tree import RepoTree


Expand Down Expand Up @@ -85,9 +86,9 @@ def test_isdir_mixed(tmp_dir, dvc):
(
True,
[
"dir/subdir1/foo1.dvc",
"dir/subdir1/bar1.dvc",
"dir/subdir2/foo2.dvc",
PathInfo("dir") / "subdir1" / "foo1.dvc",
PathInfo("dir") / "subdir1" / "bar1.dvc",
PathInfo("dir") / "subdir2" / "foo2.dvc",
],
),
],
Expand All @@ -106,22 +107,23 @@ def test_walk(tmp_dir, dvc, dvcfiles, extra_expected):
tree = RepoTree(dvc)

expected = [
"dir/subdir1",
"dir/subdir2",
"dir/subdir1/foo1",
"dir/subdir1/bar1",
"dir/subdir2/foo2",
"dir/foo",
"dir/bar",
PathInfo("dir") / "subdir1",
PathInfo("dir") / "subdir2",
PathInfo("dir") / "subdir1" / "foo1",
PathInfo("dir") / "subdir1" / "bar1",
PathInfo("dir") / "subdir2" / "foo2",
PathInfo("dir") / "foo",
PathInfo("dir") / "bar",
]

actual = []
for root, dirs, files in tree.walk("dir", dvcfiles=dvcfiles):
for entry in dirs + files:
actual.append(os.path.join(root, entry))

assert set(actual) == set(expected + extra_expected)
assert len(actual) == len(expected + extra_expected)
expected = [str(path) for path in expected + extra_expected]
assert set(actual) == set(expected)
assert len(actual) == len(expected)


def test_isdvc(tmp_dir, dvc):
Expand Down
15 changes: 8 additions & 7 deletions tests/unit/repo/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

from dvc.path_info import PathInfo
from dvc.repo.tree import DvcTree


Expand Down Expand Up @@ -115,13 +116,13 @@ def test_walk(tmp_dir, dvc):
(
True,
[
"dir/subdir1",
"dir/subdir2",
"dir/subdir1/foo1",
"dir/subdir1/bar1",
"dir/subdir2/foo2",
"dir/foo",
"dir/bar",
PathInfo("dir") / "subdir1",
PathInfo("dir") / "subdir2",
PathInfo("dir") / "subdir1" / "foo1",
PathInfo("dir") / "subdir1" / "bar1",
PathInfo("dir") / "subdir2" / "foo2",
PathInfo("dir") / "foo",
PathInfo("dir") / "bar",
],
),
],
Expand Down

0 comments on commit 4082dd2

Please sign in to comment.