Skip to content

Commit 0474842

Browse files
committed
Skip symlink-related test failures on WASI
1 parent 08ab551 commit 0474842

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Lib/test/test_tarfile.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3332,6 +3332,19 @@ def open(self, **kwargs):
33323332
bio = io.BytesIO(self.contents)
33333333
return tarfile.open(fileobj=bio, **kwargs)
33343334

3335+
# Under WASI, `os_helper.can_symlink` is False to make
3336+
# `skip_unless_symlink` skip symlink tests. "
3337+
# But in the following tests we use can_symlink to *determine* which
3338+
# behavior is expected.
3339+
# Like other symlink tests, skip these on WASI for now.
3340+
if support.is_wasi:
3341+
def symlink_test(f):
3342+
return unittest.skip("WASI: Skip symlink test for now")(f)
3343+
else:
3344+
def symlink_test(f):
3345+
return f
3346+
3347+
33353348
class TestExtractionFilters(unittest.TestCase):
33363349

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

3457+
@symlink_test
34443458
def test_parent_symlink(self):
34453459
# Test interplaying symlinks
34463460
# Inspired by 'dirsymlink2a' in jwilk/traversal-archives
@@ -3484,6 +3498,7 @@ def test_parent_symlink(self):
34843498
with self.check_context(arc.open(), 'data'):
34853499
self.expect_file('parent/evil')
34863500

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

3536+
@symlink_test
35213537
def test_absolute_symlink(self):
35223538
# Test symlink to an absolute path
35233539
# Inspired by 'dirsymlink' in jwilk/traversal-archives
@@ -3547,6 +3563,7 @@ def test_absolute_symlink(self):
35473563
tarfile.AbsoluteLinkError,
35483564
"'parent' is a symlink to an absolute path")
35493565

3566+
@symlink_test
35503567
def test_sly_relative0(self):
35513568
# Inspired by 'relative0' in jwilk/traversal-archives
35523569
with ArchiveMaker() as arc:
@@ -3580,6 +3597,7 @@ def test_sly_relative0(self):
35803597
+ "'.*moo', which is outside "
35813598
+ "the destination")
35823599

3600+
@symlink_test
35833601
def test_sly_relative2(self):
35843602
# Inspired by 'relative2' in jwilk/traversal-archives
35853603
with ArchiveMaker() as arc:

0 commit comments

Comments
 (0)