[3.13] Skip test in test_socket.py if sys.getrefcount isn't available (GH-126640) (#126645)

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 0f6bb28ff3)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
This commit is contained in:
Miss Islington (bot) 2024-11-10 16:41:42 +01:00 committed by GitHub
parent 0d3aa25ee4
commit 9473ae9b51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View 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()