]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 10 Nov 2024 15:34:52 +0000 (16:34 +0100)
committerGitHub <noreply@github.com>
Sun, 10 Nov 2024 15:34:52 +0000 (15:34 +0000)
Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640)

Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for  PyPy and other Python implementations that do not have `sys.getrefcount`.
(cherry picked from commit 0f6bb28ff3ba152faf7523ea9aaf0094cc39bdda)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
Lib/test/test_socket.py

index acfa1cd503b86b46b11df22e5ee5eb4c51e9fedb..fd328a74134bcf962055fe04ad1331fb715a6667 100644 (file)
@@ -5261,6 +5261,8 @@ class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase):
         self.write_file.write(self.write_msg)
         self.write_file.flush()
 
+    @unittest.skipUnless(hasattr(sys, 'getrefcount'),
+                         'test needs sys.getrefcount()')
     def testMakefileCloseSocketDestroy(self):
         refcount_before = sys.getrefcount(self.cli_conn)
         self.read_file.close()