def assert_query_count(num, ignore_txn=False): qh = QueryLogHandler() logger.setLevel(logging.DEBUG) logger.addHandler(qh) try: qc0 = len(qh.queries(ignore_txn=ignore_txn)) yield qh finally: logger.removeHandler(qh) qc1 = len(qh.queries(ignore_txn=ignore_txn)) assert (qc1 - qc0) == num
def setUp(self): self.qh = QueryLogHandler() logger.setLevel(logging.DEBUG) logger.addHandler(self.qh)
def setUp(self): self.qh = QueryLogHandler() logger.setLevel(logging.DEBUG) logger.addHandler(self.qh)