Skip to content

Commit

Permalink
Skip test in test_socket.py if sys.getrefcount isn't available (pyt…
Browse files Browse the repository at this point in the history
…hon#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`.
  • Loading branch information
cfbolz authored Nov 10, 2024
1 parent 160758a commit 0f6bb28
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 @@ -5334,6 +5334,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 0f6bb28

Please sign in to comment.