@contextmanager
def mock_logging(logger_names=[]):
    if logger_names:
        queue = [logging.getLogger(logger_name) for logger_name in logger_names]
    else:
        queue = [logging.getLogger('')]
    new_handler = MockHandler()
    previous_handlers = {}
    previous_propagates = {}
    for logger in queue:
        previous_handlers[logger] = logger.handlers[:]
        previous_propagates[logger] = logger.propagate
        logger.handlers = [new_handler]
        logger.propagate = 0
    yield new_handler
    for logger in queue:
        logger.handlers = previous_handlers[logger]
        logger.propagate = previous_propagates[logger]
Mocks out logging inside the context manager. If a logger name is
dataset/ETHPy150Open Yelp/Testify/testify/utils/mock_logging.py/mock_logging