allure-framework / allure-framework/allure-python

Add type hints for better mypy support

未关闭
#878 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
814
派生
260
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

调研方向

首先检查 issue 中引用的 allure 辅助 API,以及类型化 pytest 测试中的当前 mypy 错误。明确哪些 framework 辅助函数需要注解,以及覆盖范围应有多大;完成的标准是,类型化测试不再需要为这些未类型化的调用编写 wrapper 函数或进行全局抑制。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
testing
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。