def __init__(self, *args, **kwargs): '''Repeatedly attempt to establish a MongoDB connection. Arguments are passed to :class:`pymongo.connection.Connection`. ''' self._conn_args = args, kwargs self._conn = None Trier.__init__(self, self._try_connect, backoff=ExpBackoff(cap=600))
def test_start_stop(self): '''It should start and stop within 0.1 second.''' def f(): return False trier = Trier(f) trier.stop() trier.join(timeout=0.1) self.assertFalse(trier.is_alive())