]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] 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:41:42 +0000 (16:41 +0100)
committerGitHub <noreply@github.com>
Sun, 10 Nov 2024 15:41:42 +0000 (15:41 +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 4b831d666e2dc55a3ad796e317092508e17f43d3..e351ccdf057e9af65138730045114818e5a5f6a9 100644 (file)
@@ -5328,6 +5328,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()