Skip to content

Add type hints for better mypy support #878

Description

@funkindy

Hello!

We use mypy to type check our pytest tests. So we have to use wrappers for allure helpers, e.g.

from collections.abc import Callable
from typing import Any, TypeVar, cast

import allure

F = TypeVar('F', bound=Callable[..., Any])


def epic(*items: str) -> Callable[[F], F]:
    return cast('Callable[[F], F]', allure.epic(*items))  # type: ignore[no-untyped-call]


def tag(*tags: str) -> Callable[[F], F]:
    return cast('Callable[[F], F]', allure.tag(*tags))  # type: ignore[no-untyped-call]

... and so on

or even use global mute for untyped calls in typed context.

Can you please clarify if there are any plans to introduce type hints into framework?

Thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions