Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Skip symlink-related test failures on WASI
  • Loading branch information
encukou committed Apr 20, 2023
commit 0474842cbba56877557bd825bd987625c1b52e4e
18 changes: 18 additions & 0 deletions Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3332,6 +3332,19 @@ def open(self, **kwargs):
bio = io.BytesIO(self.contents)
return tarfile.open(fileobj=bio, **kwargs)

# Under WASI, `os_helper.can_symlink` is False to make
# `skip_unless_symlink` skip symlink tests. "
# But in the following tests we use can_symlink to *determine* which
# behavior is expected.
# Like other symlink tests, skip these on WASI for now.
if support.is_wasi:
def symlink_test(f):
return unittest.skip("WASI: Skip symlink test for now")(f)
else:
def symlink_test(f):
return f


class TestExtractionFilters(unittest.TestCase):

# A temporary directory for the extraction results.
Expand Down Expand Up @@ -3441,6 +3454,7 @@ def test_absolute(self):
tarfile.AbsolutePathError,
"""['"].*escaped.evil['"] has an absolute path""")

@symlink_test
def test_parent_symlink(self):
# Test interplaying symlinks
# Inspired by 'dirsymlink2a' in jwilk/traversal-archives
Expand Down Expand Up @@ -3484,6 +3498,7 @@ def test_parent_symlink(self):
with self.check_context(arc.open(), 'data'):
self.expect_file('parent/evil')

@symlink_test
def test_parent_symlink2(self):
# Test interplaying symlinks
# Inspired by 'dirsymlink2b' in jwilk/traversal-archives
Expand Down Expand Up @@ -3518,6 +3533,7 @@ def test_parent_symlink2(self):
"""'current/parent' would link to ['"].*['"], """
+ "which is outside the destination")

@symlink_test
def test_absolute_symlink(self):
# Test symlink to an absolute path
# Inspired by 'dirsymlink' in jwilk/traversal-archives
Expand Down Expand Up @@ -3547,6 +3563,7 @@ def test_absolute_symlink(self):
tarfile.AbsoluteLinkError,
"'parent' is a symlink to an absolute path")

@symlink_test
def test_sly_relative0(self):
# Inspired by 'relative0' in jwilk/traversal-archives
with ArchiveMaker() as arc:
Expand Down Expand Up @@ -3580,6 +3597,7 @@ def test_sly_relative0(self):
+ "'.*moo', which is outside "
+ "the destination")

@symlink_test
def test_sly_relative2(self):
# Inspired by 'relative2' in jwilk/traversal-archives
with ArchiveMaker() as arc:
Expand Down