Python await inside context manager
Question: for below code, will the context gets closed correctly when
async_task()
finishes?
1 | with get_context(): |
1 | #!/usr/bin/env python3 |
This test produces:
enter
sleeping
exit
So yes - context manager does work with await operation inside it.