gh-84131: Remove the deprecated pathlib.Path.link_to method. (#92505)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
This commit is contained in:
Gregory P. Smith 2022-05-10 12:31:41 -07:00 committed by GitHub
parent dde8a1668e
commit 07b34926d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 59 deletions

View file

@ -1977,28 +1977,6 @@ class _BasePathTest(object):
self.assertFileNotFound(p.stat)
self.assertFileNotFound(p.unlink)
@unittest.skipUnless(hasattr(os, "link"), "os.link() is not present")
def test_link_to(self):
P = self.cls(BASE)
p = P / 'fileA'
size = p.stat().st_size
# linking to another path.
q = P / 'dirA' / 'fileAA'
try:
with self.assertWarns(DeprecationWarning):
p.link_to(q)
except PermissionError as e:
self.skipTest('os.link(): %s' % e)
self.assertEqual(q.stat().st_size, size)
self.assertEqual(os.path.samefile(p, q), True)
self.assertTrue(p.stat)
# Linking to a str of a relative path.
r = rel_join('fileAAA')
with self.assertWarns(DeprecationWarning):
q.link_to(r)
self.assertEqual(os.stat(r).st_size, size)
self.assertTrue(q.stat)
@unittest.skipUnless(hasattr(os, "link"), "os.link() is not present")
def test_hardlink_to(self):
P = self.cls(BASE)
@ -2024,7 +2002,7 @@ class _BasePathTest(object):
# linking to another path.
q = P / 'dirA' / 'fileAA'
with self.assertRaises(NotImplementedError):
p.link_to(q)
q.hardlink_to(p)
def test_rename(self):
P = self.cls(BASE)