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

Method test_extract_hardlink_on_symlink

Lib/test/test_tarfile.py:863–874  ·  view source on GitHub ↗

This test verifies that extracting a hardlink will not follow an existing symlink after a FileExistsError on os.link.

(self)

Source from the content-addressed store, hash-verified

861 )
862 @os_helper.skip_unless_symlink
863 def test_extract_hardlink_on_symlink(self):
864 """
865 This test verifies that extracting a hardlink will not follow an
866 existing symlink after a FileExistsError on os.link.
867 """
868 with os_helper.temp_dir() as DIR:
869 target_filepath, hardlink_filepath = self._setup_symlink_to_target(DIR)
870 with tarfile.open(tarname, encoding="iso8859-1") as tar:
871 tar.extract("ustar/regtype", DIR, filter="data")
872 tar.extract("ustar/lnktype", DIR, filter="data")
873 self._assert_on_file_content(target_filepath, sha256sum(b"target"))
874 self._assert_on_file_content(hardlink_filepath, sha256_regtype)
875
876 @unittest.skipUnless(
877 hasattr(os, "link"), "Missing hardlink implementation"

Callers

nothing calls this directly

Calls 6

sha256sumFunction · 0.85
temp_dirMethod · 0.80
openMethod · 0.45
extractMethod · 0.45

Tested by

no test coverage detected