diff --git a/dvc/utils/__init__.py b/dvc/utils/__init__.py index 3a24a4f56..68ba41877 100644 --- a/dvc/utils/__init__.py +++ b/dvc/utils/__init__.py @@ -296,11 +296,6 @@ def dvc_walk(top, dvcignore, topdown=True, onerror=None, followlinks=False): for root, dirs, files in os.walk( top, topdown=topdown, onerror=onerror, followlinks=followlinks ): - # Dirs are returned in arbitrary order on different platforms. Force a - # specific order so that we can make deterministic assumptions on the - # directory order. - # https://stackoverflow.com/a/54773660/2966951 - dirs.sort() if dvcignore: dirs[:], files[:] = dvcignore(root, dirs, files) diff --git a/tests/basic_env.py b/tests/basic_env.py index d27130fbf..1fba67a55 100644 --- a/tests/basic_env.py +++ b/tests/basic_env.py @@ -48,12 +48,6 @@ class TestDirFixture(object): ) UNICODE = "тест" UNICODE_CONTENTS = "проверка" - REGULAR_DIR = "lib" - REGULAR_FILE = os.path.join(REGULAR_DIR, "file.txt") - REGULAR_FILE_CONTENTS = """ - A file used to test retrieval of regular files tracked by git that - are not stored in a dvc remote backend. - """ def __init__(self): root_dir = self.mkdtemp() @@ -102,8 +96,6 @@ class TestDirFixture(object): self.create(self.DATA, self.DATA_CONTENTS) self.create(self.DATA_SUB, self.DATA_SUB_CONTENTS) self.create(self.UNICODE, self.UNICODE_CONTENTS) - os.mkdir(self.REGULAR_DIR) - self.create(self.REGULAR_FILE, self.REGULAR_FILE_CONTENTS) def tearDown(self): self._popd() @@ -145,7 +137,6 @@ class TestGitFixture(TestDirFixture): raise self.git.index.add([self.CODE]) - self.git.index.add([self.REGULAR_DIR]) self.git.index.commit("add code") def tearDown(self): diff --git a/tests/func/test_get.py b/tests/func/test_get.py index e66f0d96b..15034eef5 100644 --- a/tests/func/test_get.py +++ b/tests/func/test_get.py @@ -38,9 +38,10 @@ def test_get_repo_dir(erepo): trees_equal(src, dst) -def test_get_regular_file(repo_dir, erepo): - src = erepo.REGULAR_FILE - dst = erepo.REGULAR_FILE + "_imported" +def test_get_regular_file(erepo): + src = os.path.join(erepo.root_dir, "file") + dst = src + "_imported" + erepo.create(src, "hello") Repo.get(erepo.root_dir, src, dst) @@ -50,9 +51,11 @@ def test_get_regular_file(repo_dir, erepo): def test_get_regular_dir(repo_dir, erepo): - src = erepo.REGULAR_DIR - dst = erepo.REGULAR_DIR + "_imported" + src = os.path.join(erepo.root_dir, "directory") + dst = src + "_imported" + os.mkdir(src) + erepo.create(os.path.join(src, "file"), "hello") Repo.get(erepo.root_dir, src, dst) assert os.path.exists(dst) diff --git a/tests/func/test_tree.py b/tests/func/test_tree.py index 6aa2f5856..c2ae316c2 100644 --- a/tests/func/test_tree.py +++ b/tests/func/test_tree.py @@ -115,7 +115,7 @@ class TestWalkInNoSCM(AssertWalkEqualMixin, TestDir): [ ( self._root_dir, - ["lib", "data_dir"], + ["data_dir"], ["code.py", "bar", "тест", "foo"], ), (join(self._root_dir, "data_dir"), ["data_sub_dir"], ["data"]), @@ -124,7 +124,6 @@ class TestWalkInNoSCM(AssertWalkEqualMixin, TestDir): [], ["data_sub"], ), - (join(self._root_dir, "lib"), [], ["file.txt"]), ], ) @@ -152,7 +151,7 @@ class TestWalkInGit(AssertWalkEqualMixin, TestGit): [ ( self._root_dir, - ["lib", "data_dir"], + ["data_dir"], ["bar", "тест", "code.py", "foo"], ), (join(self._root_dir, "data_dir"), ["data_sub_dir"], ["data"]), @@ -161,7 +160,6 @@ class TestWalkInGit(AssertWalkEqualMixin, TestGit): [], ["data_sub"], ), - (join(self._root_dir, "lib"), [], ["file.txt"]), ], ) self.assertWalkEqual( @@ -183,14 +181,13 @@ class TestWalkInGit(AssertWalkEqualMixin, TestGit): self.assertWalkEqual( tree.walk("."), [ - (self._root_dir, ["data_dir", "lib"], ["code.py"]), + (self._root_dir, ["data_dir"], ["code.py"]), (join(self._root_dir, "data_dir"), ["data_sub_dir"], []), ( join(self._root_dir, "data_dir", "data_sub_dir"), [], ["data_sub"], ), - (join(self._root_dir, "lib"), [], ["file.txt"]), ], ) self.assertWalkEqual(