def test_null_context(): Context.request_id = 'test' Context.set_debug() Context.soft_timeout = 10 Context.set_relative_deadline(10) Context.track('sql', 1.0) assert Context.request_id is None assert Context.debug is False assert Context.soft_timeout == -1 assert Context.deadline_timeout() is None assert Context.current().tracking == {} with Context.logging(foo='bar'): assert Context.logging.flat == {}
def __call__(self, extra=None, **kwargs): with Context.logging(extra, **kwargs): yield