def checkCbRefcount(self):
        if not self.should_check_refcount:
            return

        import gc
        if platform.python_implementation() == 'PyPy':
            return

        gc.collect()
        for x in range(10):
            oldrc = sys.getrefcount(self.cb)
            if oldrc > 2:
                gc.collect()
            else:
                break

        self.assertEqual(oldrc, 2)
dataset/ETHPy150Open couchbase/couchbase-python-client/couchbase/tests/base.py/ConnectionTestCase.checkCbRefcount/original