Skip to content

Commit

Permalink
[3.13] Skip test in test_socket.py if sys.getrefcount isn't availab…
Browse files Browse the repository at this point in the history
…le (pythonGH-126640) (python#126645)

Skip test in test_socket.py if `sys.getrefcount` isn't available (pythonGH-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 0f6bb28)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
  • Loading branch information
miss-islington and cfbolz authored Nov 10, 2024
1 parent 0d3aa25 commit 9473ae9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5328,6 +5328,8 @@ def _testMakefileClose(self):
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()
Expand Down

0 comments on commit 9473ae9

Please sign in to comment.