summaryrefslogtreecommitdiff
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-24 09:05:18 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-24 09:05:18 +0100
commite99b627c5613bd62cbc7bc400dc9fbcf854ca5be (patch)
tree865e292cab997bf827474460ee0587439cedf7fb /Lib/test/test_os.py
parent9088d4479dfadcfc5836cac660f9d0a90fded3b8 (diff)
parentb0384f0bae953872df333529e8c70fd81a93e304 (diff)
downloadcpython-e99b627c5613bd62cbc7bc400dc9fbcf854ca5be.tar.gz
Issue #13772: In os.symlink() under Windows, do not try to guess the link
target's type (file or directory). The detection was buggy and made the call non-atomic (therefore prone to race conditions).
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 79e66fb056..e78db48afe 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -500,7 +500,12 @@ class WalkTests(unittest.TestCase):
f.write("I'm " + path + " and proud of it. Blame test_os.\n")
f.close()
if support.can_symlink():
- os.symlink(os.path.abspath(t2_path), link_path)
+ if os.name == 'nt':
+ def symlink_to_dir(src, dest):
+ os.symlink(src, dest, True)
+ else:
+ symlink_to_dir = os.symlink
+ symlink_to_dir(os.path.abspath(t2_path), link_path)
sub2_tree = (sub2_path, ["link"], ["tmp3"])
else:
sub2_tree = (sub2_path, [], ["tmp3"])
@@ -1131,7 +1136,7 @@ class Win32SymlinkTests(unittest.TestCase):
os.remove(self.missing_link)
def test_directory_link(self):
- os.symlink(self.dirlink_target, self.dirlink)
+ os.symlink(self.dirlink_target, self.dirlink, True)
self.assertTrue(os.path.exists(self.dirlink))
self.assertTrue(os.path.isdir(self.dirlink))
self.assertTrue(os.path.islink(self.dirlink))