allure-framework / allure-framework/allure-python
Improve context manager
- 主要语言
- Python
- 星标
- 814
- 派生
- 260
- PR 合并指标
- 30 天内没有已合并 PR
描述
#### I'm submitting a ...
- [x] feature request
#### What is the current behavior?
Context manager for `allure.step()` does not allow assigning a variable name, which would be useful.
#### What is the expected behavior?
I'd like it if this worked:
```py
with allure.step('foo') as s:
print(s.title)
```
I expected that to work because this does work:
```py
s = allure.step('foo')
print(s.title)
```
#### What is the motivation / use case for changing the behavior?
Having this named context manager would keep very simple code DRY.
#### Please tell us about your environment:
- Allure version: 🤷♂️ I'm just doing the code review, not sure how to determine this.
- Test framework: pytest@^8.2.2
- Allure adaptor: allure-pytest@^2.13.5
贡献指南
调研方向
从 allure.step() 上下文管理器的入口点开始,使用 pytest 重现两个使用示例。当 `with allure.step('foo') as s` 暴露出与直接赋值相同的 `title` 值时,修改即完成;添加或更新与此行为相关的测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- testing
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100