Skip to content

Type error: Value of type variable "_R" of function cannot be "AsyncClient" #1090

@jamesbraza

Description

@jamesbraza

Upgrading to pytest-asyncio==0.26.0:

import pytest_asyncio
from httpx import AsyncClient


@pytest_asyncio.fixture(scope="function")
def server_async_client() -> AsyncClient: ...

I get this error from mypy:

a.py:5:2: error: Value of type variable "_R" of function cannot be "AsyncClient"  [type-var]
    @pytest_asyncio.fixture(scope="function")
     ^

This is with Python 3.12.7 and the following packages:

httpx                     0.27.2
mypy                      1.15.0
pytest                    8.3.5
pytest-asyncio            0.25.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions