MCPcopy Index your code
hub / github.com/python/cpython / test_link_size

Method test_link_size

Lib/test/test_tarfile.py:1537–1557  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1535 @unittest.skipUnless(hasattr(os, "link"),
1536 "Missing hardlink implementation")
1537 def test_link_size(self):
1538 link = os.path.join(TEMPDIR, "link")
1539 target = os.path.join(TEMPDIR, "link_target")
1540 with open(target, "wb") as fobj:
1541 fobj.write(b"aaa")
1542 try:
1543 os.link(target, link)
1544 except PermissionError as e:
1545 self.skipTest('os.link(): %s' % e)
1546 try:
1547 tar = tarfile.open(tmpname, self.mode)
1548 try:
1549 # Record the link target in the inodes list.
1550 tar.gettarinfo(target)
1551 tarinfo = tar.gettarinfo(link)
1552 self.assertEqual(tarinfo.size, 0)
1553 finally:
1554 tar.close()
1555 finally:
1556 os_helper.unlink(target)
1557 os_helper.unlink(link)
1558
1559 @os_helper.skip_unless_symlink
1560 def test_symlink_size(self):

Callers

nothing calls this directly

Calls 9

skipTestMethod · 0.80
gettarinfoMethod · 0.80
openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
openMethod · 0.45
assertEqualMethod · 0.45
closeMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected