def test_queueing_fails_with_no_queue(event_queue_loop): # Prerequisite: the context-var should not be set by anything in advance. sentinel = object() assert event_queue_var.get(sentinel) is sentinel with pytest.raises(LookupError): event(OBJ1, type='type1', reason='reason1', message='message1')
async def wrapper(*args, **kwargs): with handler_errors.count_exceptions(): with handler_latency.time(): r = await func(*args, **kwargs) handler_last.set_to_current_time() try: qsize = event_queue_var.get().qsize() except LookupError: qsize = -1 settings.METRICS["queue"].set(qsize) settings.METRICS["threads"].set(threading.active_count()) return r