]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Skip test in test_socket.py if `sys.getrefcount` isn't available (#126640)
authorCF Bolz-Tereick <cfbolz@gmx.de>
Sun, 10 Nov 2024 15:16:36 +0000 (16:16 +0100)
committerGitHub <noreply@github.com>
Sun, 10 Nov 2024 15:16:36 +0000 (17:16 +0200)
Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for  PyPy and other Python implementations that do not have `sys.getrefcount`.

Lib/test/test_socket.py

index f2bc52ba6e8701062d70abe4dc7b4a20d9c77467..dc8a4a44f37e657412f2de4a68e35b9959d26c63 100644 (file)
@@ -5334,6 +5334,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()