Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55e3218

Browse files
Issues #23808, #25911: Trying to fix walk tests on Windows.
On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.
2 parents f4d97ce + 388b90f commit 55e3218

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_os.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,11 @@ def setUp(self):
837837
if support.can_symlink():
838838
os.symlink(os.path.abspath(t2_path), self.link_path)
839839
os.symlink('broken', broken_link_path, True)
840-
self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"])
840+
if os.path.isdir(broken_link_path):
841+
# On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.
842+
self.sub2_tree = (sub2_path, ["broken_link", "link"], ["tmp3"])
843+
else:
844+
self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"])
841845
else:
842846
self.sub2_tree = (sub2_path, [], ["tmp3"])
843847

0 commit comments

Comments
 (0)