allure-framework / allure-framework/allure-python
Improve context manager
- Dominant language
- Python
- Stars
- 814
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Description
#### 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
Contributor guide
Research direction
Start at the allure.step() context-manager entry point and reproduce the two usage examples with pytest. The change is done when `with allure.step('foo') as s` exposes the same `title` value as direct assignment; add or update the relevant tests around this behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100