Skip to content
Merged
Changes from all commits
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
24 changes: 0 additions & 24 deletions Lib/test/test_tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1594,30 +1594,6 @@ def test_unexpected_error(self):
mock_close.assert_called()
self.assertEqual(os.listdir(dir), [])

@os_helper.skip_unless_hardlink
@unittest.skipUnless(tempfile._O_TMPFILE_WORKS, 'need os.O_TMPFILE')
@unittest.skipUnless(os.path.exists('/proc/self/fd'),
'need /proc/self/fd')
def test_link_tmpfile(self):
dir = tempfile.mkdtemp()
self.addCleanup(os_helper.rmtree, dir)
filename = os.path.join(dir, "link")

with tempfile.TemporaryFile('w', dir=dir) as tmp:
# the flag can become False on Linux <= 3.11
if not tempfile._O_TMPFILE_WORKS:
self.skipTest("O_TMPFILE doesn't work")

tmp.write("hello")
tmp.flush()
fd = tmp.fileno()

os.link(f'/proc/self/fd/{fd}',
filename,
follow_symlinks=True)
with open(filename) as fp:
self.assertEqual(fp.read(), "hello")


# Helper for test_del_on_shutdown
class NulledModules:
Expand Down
Loading