From: CF Bolz-Tereick Date: Sun, 10 Nov 2024 15:16:36 +0000 (+0100) Subject: Skip test in test_socket.py if `sys.getrefcount` isn't available (#126640) X-Git-Tag: v3.14.0a2~106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f6bb28ff3ba152faf7523ea9aaf0094cc39bdda;p=thirdparty%2FPython%2Fcpython.git Skip test in test_socket.py if `sys.getrefcount` isn't available (#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`. --- diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index f2bc52ba6e87..dc8a4a44f37e 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -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()