Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Feature or enhancement
Proposal:
Sometimes, mostly in tests, I write something like
fromcontextvarsimportContextVarvar=ContextVar('var')deftest_a():token=var.set('new val')do_stuff()var.reset(token)
It looks a little cumbersome, the support forwith 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