def test_logging_context_ctx(): Context.new() with logs.logging_context(a=1): assert logs.logging_context.flat == {'a': 1} with logs.logging_context(a=2): assert logs.logging_context.flat == {'a': 2} assert logs.logging_context.flat == {'a': 1}
def context(id): with logging_context(request_id=id): yield
def context(id): with logging_context(request_id=id): yield
def test_logging_context_ctx(): with logs.logging_context(a=1): assert logs.logging_context.flat == {'a': 1} with logs.logging_context(a=2): assert logs.logging_context.flat == {'a': 2} assert logs.logging_context.flat == {'a': 1}