quart
quart copied to clipboard
ContextVars are not propagated from fixtures with pytest-asyncio
This is more of a pytest-asyncio bug, see https://github.com/pytest-dev/pytest-asyncio/issues/127
@pytest.fixture(scope='class')
async def test_context(self):
async with app.app_context():
async with app.test_request_context("/"):
setattr(quart.g, 'test', 'value')
yield
@pytest.mark.asyncio
async def test_global(test_context):
assert quart.g.test == 'value'
https://github.com/pallets/quart/issues/415
The referenced pytest-asyncio issue has been resolved as of v1.1.0.
Can you try upgrading pytest-asyncio and report back if this resolves your issue? I see you're already on v1.0.0, so the upgrade should be painless.