diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 4b831d666e2dc5..e351ccdf057e9a 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -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()