allure-framework / allure-framework/allure-python

Add type hints for better mypy support

Open
#878 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
814
Forks
260
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the allure helper APIs referenced in the issue and the current mypy errors in typed pytest tests. Clarify which framework helpers require annotations and how broad the coverage should be; done means typed tests no longer need wrapper functions or global suppression for these untyped calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.