GeezerVison is showing github.com — Support allure.title decorator for fixtures · Issue #210 · allure-framework/allure-python
Support allure.title decorator for fixtures #210DescriptionI'm submitting a ...
- bug report
- feature request
- support request => Please do not submit support request here, see note at the top of this template.
What is the current behavior?
All of fixtures are shown at report as they named in code.
What is the expected behavior?
I suggest to support allure.title decorator for fixtures as it made for tests.
Code example:
@allure.title('custom title')
@pytest.fixture(autouse=True)
def function_fixture(self,request,pytestconfig):
Please note that it should have effect both for setup and teardown steps. Also, there are old-style fixtures and yield fixtures - both of them should have an ability to use allure.title.
What is the motivation / use case for changing the behavior?
It will add possibility to make abstract of fixture representation in report from its realization in code. Reports will be easier to read for people not relating to code (managers etc).
Please tell us about your environment:
Activitysymonk commented on Feb 27, 2019 I will look into this one, I have a need for it personally also ShurikMen commented on Sep 9, 2020 Maybe this is what is required?
import pytest
import allure
@pytest.fixture(name='Какая-то фикстура')
def some_fixture():
with allure.step('Подшаг в фикстуре, при настройке'):
pass
yield "Эта фиктура возвращает волшебное слово"
with allure.step('Подшаг в фикстуре, при завершении'):
pass
class TestClassOne:
@pytest.mark.usefixtures('Какая-то фикстура')
def test_1(self, request):
with allure.step('Шаг в функции'):
allure.attach(request.getfixturevalue('Какая-то фикстура'), 'Получили из фикстуры:', allure.attachment_type.TEXT)

Reacted by Simon K and Peter rad96 commented on Nov 30, 2020
Maybe this is what is required?
import pytest
import allure
@pytest.fixture(name='Какая-то фикстура')
def some_fixture():
with allure.step('Подшаг в фикстуре, при настройке'):
pass
yield "Эта фиктура возвращает волшебное слово"
with allure.step('Подшаг в фикстуре, при завершении'):
pass
class TestClassOne:
@pytest.mark.usefixtures('Какая-то фикстура')
def test_1(self, request):
with allure.step('Шаг в функции'):
allure.attach(request.getfixturevalue('Какая-то фикстура'), 'Получили из фикстуры:', allure.attachment_type.TEXT)

That's looks like a complicated overhead
I made a little hack for parsing allure tag directly from source, it works, but it don't support any parametrization added a commit that references this issue on Dec 6, 2020This issue will close once commit ed38912 is merged into the 'master' branch.ed38912 added 2 commits that reference this issue on Apr 10, 2023This issue will close once commit c4d4034 is merged into the 'master' branch.c4d4034 This issue will close once commit de6c243 is merged into the 'master' branch.de6c243 added a commit that references this issue on Mar 19, 2024This issue will close once commit 330afa1 is merged into the 'master' branch.330afa1
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|