bpo-9949: Enable symlink traversal for ntpath.realpath (GH-15287)

(cherry picked from commit 75e064962e)

Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
Miss Islington (bot) 2019-08-21 14:09:33 -07:00 committed by GitHub
parent 7e293f5e4c
commit c30c869e8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 304 additions and 32 deletions

View file

@ -1871,11 +1871,7 @@ class TestMove(unittest.TestCase):
dst_link = os.path.join(self.dst_dir, 'quux')
shutil.move(dst, dst_link)
self.assertTrue(os.path.islink(dst_link))
# On Windows, os.path.realpath does not follow symlinks (issue #9949)
if os.name == 'nt':
self.assertEqual(os.path.realpath(src), os.readlink(dst_link))
else:
self.assertEqual(os.path.realpath(src), os.path.realpath(dst_link))
self.assertEqual(os.path.realpath(src), os.path.realpath(dst_link))
@support.skip_unless_symlink
@mock_rename