Title: Allure step placeholder fails when accessing dataclass attribute `data.name` · Issue #896 · allure-framework/allure-python · GitHub
Open Graph Title: Allure step placeholder fails when accessing dataclass attribute `data.name` · Issue #896 · allure-framework/allure-python
X Title: Allure step placeholder fails when accessing dataclass attribute `data.name` · Issue #896 · allure-framework/allure-python
Description: With the usage provided in step_placeholder.rst, I used Allure step placeholders to reference a property on a Python dataclass passed as a function argument. Using data.name in the step title raises an AttributeError during step renderin...
Open Graph Description: With the usage provided in step_placeholder.rst, I used Allure step placeholders to reference a property on a Python dataclass passed as a function argument. Using data.name in the step title raise...
X Description: With the usage provided in step_placeholder.rst, I used Allure step placeholders to reference a property on a Python dataclass passed as a function argument. Using data.name in the step title raise...
Opengraph URL: https://github.com/allure-framework/allure-python/issues/896
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allure step placeholder fails when accessing dataclass attribute `data.name`","articleBody":"With the usage provided in [step_placeholder.rst](https://github.com/allure-framework/allure-python/blob/master/allure-pytest/examples/step/step_placeholder.rst), I used Allure step placeholders to reference a property on a Python `dataclass` passed as a function argument. Using `data.name` in the step title raises an `AttributeError` during step rendering.\n\n#### Expected behavior\n\nAllure should resolve `data.name` and display the value of the `name` attribute in the step title like Create opportunity: Auto QA Example\n\n#### Actual behavior\n\nAllure raises an exception before the step executes: `AttributeError: 'str' object has no attribute 'get('name)'`\n\nMWE of dataclass used\n\n```python\n\n@dataclass\nclass OpportunityData:\n \"\"\"Data class for opportunity test data.\"\"\"\n \n name: str\n expected_revenue: str\n email: Optional[str] = None\n phone: Optional[str] = None\n state: Optional[str] = None\n street: Optional[str] = None\n zip_code: Optional[str] = None\n```\n\nFactory function for Opportunity creation\n```python\ndef create_opportunity_data() -\u003e OpportunityData:\n \"\"\"Factory function to create OpportunityData for tests.\"\"\"\n\n \n data = OpportunityData(\n name=f\"Auto QA {fake.company()}\",\n expected_revenue=_generate_expected_revenue(),\n email = fake.email()\n phone = fake.phone_number()\n street = fake.street_address()\n zip_code = fake.zipcode()\n state=fake.random_element(STATE_OPTIONS),\n )\n \n return data\n```\nTest Opportunity file\n```python\n@allure.title(\"Test opportunity creation with all main fields\")\n@allure.testcase(\"CRM-002\")\n@pytest.mark.regression\ndef test_opportunity_creation_full(opportunity_page: OpportunityPage, app_instance: App) -\u003e None:\n \n # ARRANGE\n data = create_opportunity_data(full=True, opportunity_type=\"CRM Multi-Year\")\n \n # ACT\n opportunity_page.create_opportunity(data)\n \n # ASSERT\n opportunity_page.verify_opportunity_saved(data.name)\n\n```\nOpportunity Page class\n```python\n @allure.step(\"Create opportunity: {data.name}\")\n def create_opportunity(self, data: \"OpportunityData\", base_url: str) -\u003e Self:\n \"\"\"High-level method to create an opportunity with provided data.\"\"\"\n \n \n # Fill main form fields\n self.fill_opportunity_name(data.name)\n self.fill_expected_revenue(data.expected_revenue)\n\n```\n\nCall stack\n\n```\napp_instance = \u003csrc.app.App object at 0x7f9f3034f8c0\u003e\n\n @allure.title(\"Test opportunity creation with minimal fields\")\n @allure.testcase(\"CRM-001\")\n @pytest.mark.smoke\n def test_opportunity_creation_flow(opportunity_page: OpportunityPage, app_instance: App) -\u003e None:\n \n # ARRANGE\n data = create_opportunity_data(opportunity_type=\"Monitoring\")\n \n # ACT\n\u003e opportunity_page.create_opportunity(data, app_instance.base_url)\nE AttributeError: 'str' object has no attribute 'get('name)'\n```\n\n#### Notes\n\n* `data` is a dataclass instance, not a dict.\n* Attribute access works inside the function body.\n* The error occurs during Allure step title formatting.\n\n\n#### Environment\n\n* Python 3.12\n* allure-pytest==2.15.2\n* pytest==8.4.2\n* pytest-playwright==0.7.2\n* mypy==1.19.0\n* mypy-extensions==1.1.0\n\nDoes allure step placeholders accept only strings?\n","author":{"url":"https://github.com/recluzegeek","@type":"Person","name":"recluzegeek"},"datePublished":"2026-01-07T11:14:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/896/allure-python/issues/896"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e775c379-ec2c-639f-558f-a20c2f53f194 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9844:2056C8:593E65:7C61EE:696E5A8B |
| html-safe-nonce | df7ab32e3c11d66113d6db0615ad98b9903dfb861535797bab375e79ce40fd60 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODQ0OjIwNTZDODo1OTNFNjU6N0M2MUVFOjY5NkU1QThCIiwidmlzaXRvcl9pZCI6IjQ4NzUwMDYyNTE3NTEwNzAzNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b1732048a6f0ae7fe11e0c026946cb23ee857ed3c6057049ec934d88ad063f24 |
| hovercard-subject-tag | issue:3788330587 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/allure-framework/allure-python/896/issue_layout |
| twitter:image | https://opengraph.githubassets.com/413daeabb661a6fa52869a3fb88e025c9d25d22687ddc55016a1ea72ac92298f/allure-framework/allure-python/issues/896 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/413daeabb661a6fa52869a3fb88e025c9d25d22687ddc55016a1ea72ac92298f/allure-framework/allure-python/issues/896 |
| og:image:alt | With the usage provided in step_placeholder.rst, I used Allure step placeholders to reference a property on a Python dataclass passed as a function argument. Using data.name in the step title raise... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | recluzegeek |
| hostname | github.com |
| expected-hostname | github.com |
| None | f68b42d371252b0f236260d6234f4304a806fe5ac43d59faa21fb59d80df103b |
| turbo-cache-control | no-preview |
| go-import | github.com/allure-framework/allure-python git https://github.com/allure-framework/allure-python.git |
| octolytics-dimension-user_id | 5879127 |
| octolytics-dimension-user_login | allure-framework |
| octolytics-dimension-repository_id | 79346720 |
| octolytics-dimension-repository_nwo | allure-framework/allure-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 79346720 |
| octolytics-dimension-repository_network_root_nwo | allure-framework/allure-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6b74bc8dbcd10b5d69fd9ee9d2cfdc8b35e18a4c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width