Skip to content

Commit c21182d

Browse files
committed
Use @os_helper.skip_unless_hardlinkv
1 parent 00cb444 commit c21182d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Lib/test/test_tempfile.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,7 @@ def test_unexpected_error(self):
15941594
mock_close.assert_called()
15951595
self.assertEqual(os.listdir(dir), [])
15961596

1597+
@os_helper.skip_unless_hardlink
15971598
@unittest.skipUnless(tempfile._O_TMPFILE_WORKS, 'need os.O_TMPFILE')
15981599
@unittest.skipUnless(os.path.exists('/proc/self/fd'),
15991600
'need /proc/self/fd')
@@ -1611,14 +1612,9 @@ def test_link_tmpfile(self):
16111612
tmp.flush()
16121613
fd = tmp.fileno()
16131614

1614-
try:
1615-
os.link(f'/proc/self/fd/{fd}',
1616-
filename,
1617-
follow_symlinks=True)
1618-
except PermissionError as exc:
1619-
# gh-136156: link() fails with PermissionError on Android
1620-
self.skipTest(f"os.link: {exc!r}")
1621-
1615+
os.link(f'/proc/self/fd/{fd}',
1616+
filename,
1617+
follow_symlinks=True)
16221618
with open(filename) as fp:
16231619
self.assertEqual(fp.read(), "hello")
16241620

0 commit comments

Comments
 (0)