allure-framework / allure-framework/allure-python

Improve context manager

Open
#826 3 comments 0 reactions 0 assignees View on GitHub
task:new feature theme:core
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.