allure-framework / allure-framework/allure-python
AssertionError vs Exception
- 主要语言
- Python
- 星标
- 814
- 派生
- 260
- PR 合并指标
- 30 天内没有已合并 PR
描述
Currently Allure fails only on AssertionError and all Exception is treated as Broken.
This is a good feature but pytest reports them as Fail. This causes a bit of confusion on the report status.
An intermediate approach can be to allow for option on what constitutes a fail.
A suggestion is to provide an API where one can register baseclasses that can be as failures. This provides for better control to use with infrastructures that can have some common analysis to look for additional failures.
```
def get_status(exception):
if exception:
if isinstance(exception, AssertionError) or isinstance(exception, pytest.fail.Exception):
return Status.FAILED
elif isinstance(exception, pytest.skip.Exception):
return Status.SKIPPED
return Status.BROKEN
else:
return Status.PASSED
```
=> Something like...
```
def get_status(exception):
if exception:
for base_class in allure.FailExceptionList:
if isinstance(exception, base_class):
return Status.FAILED
elif isinstance(exception, pytest.skip.Exception):
return Status.SKIPPED
return Status.BROKEN
else:
return Status.PASSED
```
贡献指南
调研方向
该 issue 未指定任何实现文件或测试。首先定位由 get_status 及其 pytest 集成所代表的现有异常到状态路径;完成标准是允许配置异常基类,同时保留 failed、skipped、broken 和 passed 状态的处理。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- testing-qa
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100