Right now the nursery fixture is implemented in a pretty hacky way by patching the item object given by pytest:
|
@pytest.fixture |
|
async def nursery(request): |
|
return request.node._trio_nursery |
I wonder if it wouldn't be better to use the contextvars feature now that it is availble (even in older version of python thanks to Yury's backport https://github.com/MagicStack/contextvars)
Right now the nursery fixture is implemented in a pretty hacky way by patching the item object given by pytest:
pytest-trio/pytest_trio/plugin.py
Lines 282 to 284 in a972dc6
I wonder if it wouldn't be better to use the contextvars feature now that it is availble (even in older version of python thanks to Yury's backport https://github.com/MagicStack/contextvars)