Feature or enhancement
Proposal:
Sometimes, mostly in tests, I write something like
from contextvars import ContextVar
var = ContextVar('var')
def test_a():
token = var.set('new val')
do_stuff()
var.reset(token)
It looks a little cumbersome, the support for with var: would be awesome:
def test_b():
with var.set('new val'):
do_stuff()
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
Sometimes, mostly in tests, I write something like
It looks a little cumbersome, the support for
with var:would be awesome:Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs