

def _connect_to_local_mongodb(self, num_retries=60):
    'Performs retries on connection refused errors (for travis-ci builds)'
    for retry in range(num_retries):
        if (retry > 0):
            time.sleep(0.5)
        try:
            return PymongoClient()
        except pymongo.errors.ConnectionFailure as e:
            if (retry == (num_retries - 1)):
                raise
            if ('connection refused' not in e.message.lower()):
                raise

dataset/ETHPy150Open vmalloc/mongomock/tests/test__mongomock.py _CollectionComparisonTest._connect_to_local_mongodb/original