Skip to content
Prev Previous commit
Next Next commit
Fix test_tarfile (for not exporting LinkFallbackError) and remove the
non-strict test for unreadable symlinks, whch isn't supported before 3.13.
  • Loading branch information
Yhg1s committed Jun 3, 2025
commit 6d4d4d63d36646ab5791c8999ed33912ee164c9d
16 changes: 0 additions & 16 deletions Lib/test/test_posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,22 +739,6 @@ def test_realpath_resolve_first(self, kwargs):
safe_rmdir(ABSTFN + "/k")
safe_rmdir(ABSTFN)

@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
@unittest.skipIf(os.chmod not in os.supports_follow_symlinks, "Can't set symlink permissions")
@unittest.skipIf(sys.platform != "darwin", "only macOS requires read permission to readlink()")
def test_realpath_unreadable_symlink(self):
try:
os.symlink(ABSTFN+"1", ABSTFN)
os.chmod(ABSTFN, 0o000, follow_symlinks=False)
self.assertEqual(realpath(ABSTFN), ABSTFN)
self.assertEqual(realpath(ABSTFN + '/foo'), ABSTFN + '/foo')
self.assertEqual(realpath(ABSTFN + '/../foo'), dirname(ABSTFN) + '/foo')
self.assertEqual(realpath(ABSTFN + '/foo/..'), ABSTFN)
finally:
os.chmod(ABSTFN, 0o755, follow_symlinks=False)
os_helper.unlink(ABSTFN)

@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
@unittest.skipIf(os.chmod not in os.supports_follow_symlinks, "Can't set symlink permissions")
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2533,7 +2533,7 @@ def test__all__(self):
"fully_trusted_filter", "data_filter",
"tar_filter", "FilterError", "AbsoluteLinkError",
"OutsideDestinationError", "SpecialFileError", "AbsolutePathError",
"LinkOutsideDestinationError",
"LinkOutsideDestinationError", "LinkFallbackError",
}
support.check__all__(self, tarfile, not_exported=not_exported)

Expand Down
Loading