]> granicus.if.org Git - python/commitdiff
Issues #23808, #25911: Trying to fix walk tests on Windows.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 8 Mar 2016 14:11:26 +0000 (16:11 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 8 Mar 2016 14:11:26 +0000 (16:11 +0200)
On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.

Lib/test/test_os.py

index e29b0d585c723004635d1d02d6669e587fd6ec66..c5f5937889f76bb4dc54de81cba5f8de1c5682a3 100644 (file)
@@ -770,7 +770,11 @@ class WalkTests(unittest.TestCase):
         if support.can_symlink():
             os.symlink(os.path.abspath(t2_path), self.link_path)
             os.symlink('broken', broken_link_path, True)
-            self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"])
+            if os.path.isdir(broken_link_path):
+                # On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.
+                self.sub2_tree = (sub2_path, ["broken_link", "link"], ["tmp3"])
+            else:
+                self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"])
         else:
             self.sub2_tree = (sub2_path, [], ["tmp3"])