Skip to content

App context not shared via pytest fixtures #222

@GENL

Description

@GENL

Hi, I wonder why the quart's app context cannot be shared via fixtures.

@pytest.fixture
async def app_context(app): # app is a quart instance
    async with app.app_context() as app_context:
          await async_call() # All good: context is available here:
          yield app_context


async def test_smth(app_context):
    await async_call() # Error: not within an app context

We would expect the test to be running normally at the yield, but it doesn't like the context is lost. I'm I missing something or at least can this behavior be explained to me, please? Could it be a bug in the async-io level itself?

Thank you 🙏

Environment:

  • Python version: 3.9
  • Quart version: 0.18.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions