Issues #23808, #25911: Trying to fix walk tests on Windows. · python/cpython@388b90f (original) (raw)

Original file line number Diff line number Diff line change
@@ -770,7 +770,11 @@ def setUp(self):
770 770 if support.can_symlink():
771 771 os.symlink(os.path.abspath(t2_path), self.link_path)
772 772 os.symlink('broken', broken_link_path, True)
773 -self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"])
773 +if os.path.isdir(broken_link_path):
774 +# On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.
775 +self.sub2_tree = (sub2_path, ["broken_link", "link"], ["tmp3"])
776 +else:
777 +self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"])
774 778 else:
775 779 self.sub2_tree = (sub2_path, [], ["tmp3"])
776 780