def run_heartbeat(self, get_holders_fun, count=2, interval=0.05, timeout=0.05): ch = ConnectionHeartbeat(interval, get_holders_fun, timeout=timeout) # wait until the thread is started wait_until(lambda: get_holders_fun.call_count > 0, 0.01, 100) time.sleep(interval * (count - 1)) ch.stop() self.assertTrue(get_holders_fun.call_count)
def run_heartbeat(self, get_holders_fun, count=2, interval=0.05): ch = ConnectionHeartbeat(interval, get_holders_fun) time.sleep(interval * count) ch.stop() self.assertTrue(get_holders_fun.call_count)