mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
dde8a1668e
commit
07b34926d3
5 changed files with 7 additions and 59 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue