Skip to content

Commit aeebdc8

Browse files
committed
Make tests more chatty
1 parent fd5ba13 commit aeebdc8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Lib/test/test_ntpath.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,12 +964,15 @@ def test_realpath_permission(self):
964964
# Automatic generation of short names may be disabled on
965965
# NTFS volumes for the sake of performance.
966966
# They're not supported at all on ReFS and exFAT.
967-
subprocess.run(
967+
p = subprocess.run(
968968
# Try to set the short name manually.
969969
['fsutil.exe', 'file', 'setShortName', test_file, 'LONGFI~1.TXT'],
970970
creationflags=subprocess.DETACHED_PROCESS
971971
)
972972

973+
if p.returncode:
974+
raise unittest.SkipTest('failed to set short name')
975+
973976
try:
974977
self.assertPathEqual(test_file, ntpath.realpath(test_file_short))
975978
except AssertionError:
@@ -988,6 +991,7 @@ def test_realpath_permission(self):
988991
self.assertPathEqual(test_file, ntpath.realpath(test_file_short))
989992
with self.assertRaises(OSError):
990993
ntpath.realpath(test_file_short, strict=True)
994+
with self.assertRaises(OSError):
991995
ntpath.realpath(test_file_short, strict='allow_missing')
992996

993997
def test_expandvars(self):

Lib/test/test_tarfile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3788,6 +3788,10 @@ def test_parent_symlink(self):
37883788
@symlink_test
37893789
def test_realpath_limit_attack(self):
37903790
# (CVE-2025-4517)
3791+
3792+
if not os_helper.can_symlink():
3793+
raise SkipTest('requires symlinking ability')
3794+
37913795
with ArchiveMaker() as arc:
37923796
# populate the symlinks and dirs that expand in os.path.realpath()
37933797
# The number is chosen so that in common cases, the unexpanded

0 commit comments

Comments
 (0)