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'