https://github.com/python/cpython/commit/cbf007beeb2f69d9409b6388ee8d71007fa6c2df
commit: cbf007beeb2f69d9409b6388ee8d71007fa6c2df
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-07-11T16:45:31+02:00
summary:

gh-136156: Remove tempfile test_link_tmpfile() (#136534)

It's not always possible to guarantee that the file was opened with
O_TMPFILE even if tempfile._O_TMPFILE_WORKS is true.

files:
M Lib/test/test_tempfile.py

diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index aeca62cf2564bc..52b13b98cbcce5 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -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:

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to