Skip to content

Decorator type signatures not recognized by pyright #731

Open
@charles-dyfis-net

Description

@charles-dyfis-net

...and according to pyright upstream, this is a bug in mypy, rather than in pyright.

Type-checking pytest-asyncio itself yields a great many errors, starting with:

pytest-asyncio/pytest_asyncio/plugin.py:57:60 - error: Type variable "_R" has no meaning in this context (reportGeneralTypeIssues)
pytest-asyncio/pytest_asyncio/plugin.py:57:36 - error: TypeVar bound type cannot be generic
pytest-asyncio/pytest_asyncio/plugin.py:60:65 - error: Type variable "_R" has no meaning in this context (reportGeneralTypeIssues)
pytest-asyncio/pytest_asyncio/plugin.py:60:37 - error: TypeVar bound type cannot be generic

...and type-checking a project that uses pytest-asyncio's decorators with reportUntypedFunctionDecorator set in pyright's configuration:

error: Untyped function decorator obscures type of function; ignoring decorator (reportUntypedFunctionDecorator)

I suspect that the option of either passing the function to be used as a fixture as a direct argument to fixture() or returning a function that acts as a proper decorator adds complexity here. If it's not possible to be pyright-friendly with the existing calling convention flexibility, might it make sense to offer a less-flexible, more explicitly-typed alternative?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions