Title: [BUG] Latest pytest release (8.1.0) breaks allure_listener plugin · Issue #794 · allure-framework/allure-python · GitHub
Open Graph Title: [BUG] Latest pytest release (8.1.0) breaks allure_listener plugin · Issue #794 · allure-framework/allure-python
X Title: [BUG] Latest pytest release (8.1.0) breaks allure_listener plugin · Issue #794 · allure-framework/allure-python
Description: I'm submitting a ... [*] bug report What is the current behavior? After pytest released its latest version 8.1.0 it suddenly started to break allure_listener plugin on fixtures initilization/teardown thus preventing from running any test...
Open Graph Description: I'm submitting a ... [*] bug report What is the current behavior? After pytest released its latest version 8.1.0 it suddenly started to break allure_listener plugin on fixtures initilization/teardo...
X Description: I'm submitting a ... [*] bug report What is the current behavior? After pytest released its latest version 8.1.0 it suddenly started to break allure_listener plugin on fixtures initilization/te...
Opengraph URL: https://github.com/allure-framework/allure-python/issues/794
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] Latest pytest release (8.1.0) breaks allure_listener plugin","articleBody":"[//]: # (\r\n. Note: for support questions, please use Stackoverflow or Gitter**. \r\n. This repository's issues are reserved for feature requests and bug reports.\r\n.\r\n. In case of any problems with Allure Jenkins plugin** please use the following repository \r\n. to create an issue: https://github.com/jenkinsci/allure-plugin/issues\r\n.\r\n. Make sure you have a clear name for your issue. The name should start with a capital \r\n. letter and no dot is required in the end of the sentence. An example of good issue names:\r\n.\r\n. - The report is broken in IE11\r\n. - Add an ability to disable default plugins\r\n. - Support emoji in test descriptions\r\n)\r\n\r\n#### I'm submitting a ... \r\n - [*] bug report\r\n\r\n#### What is the current behavior?\r\nAfter `pytest` released its latest version `8.1.0` it suddenly started to break `allure_listener` plugin on fixtures initilization/teardown thus preventing from running any tests with `pytest` and `allure-pytest` installed.\r\n\r\n#### If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem\r\n1. Have `pytest=8.1.0` installed\r\n2. Have `allure-pytest` installed (as of the moment of writing it is `2.13.0`)\r\n3. Have simple project with `pytest` configured\r\n4. Have fixtures defined with `@pytest.fixture` decorator\r\n\r\nThe following is a minimal example the I could reproduce from our tests that caught this issue:\r\n\r\n```python\r\n# conftest.py\r\nimport pytest\r\n\r\nclass MyBaseTestClass:\r\n def __init__(self, val):\r\n self.val = val\r\n\r\n@pytest.fixture\r\ndef my_fixture():\r\n yield MyBaseTestClass(\"some value\")\r\n```\r\n\r\n```python\r\n# test_example.py\r\ndef test_my_fixture(my_fixture):\r\n assert my_fixture.val == \"some value\"\r\n```\r\n\r\n#### What is the expected behavior?\r\nIt is expected for `allure-pytest` not to break whole project when updating to `pytest==8.1.0`\r\n\r\n#### What is the motivation / use case for changing the behavior?\r\nNot to break tests\r\n\r\n#### Please tell us about your environment:\r\n\r\n- Allure version: 2.26.0\r\n- Test framework: pytest@8.1.0\r\n- Allure adaptor: allure-pytest@2.13.0\r\n\r\n#### Other information \r\n\r\nWhen running the test the stack trace gives the following error:\r\n\r\n```python\r\nself = \u003callure_pytest.listener.AllureListener object at 0x1378f7250\u003e, item = \u003cFunction test_create_enum_metadata[options_bounds0]\u003e\r\n\r\n @pytest.hookimpl(hookwrapper=True)\r\n def pytest_runtest_setup(self, item):\r\n if not self._cache.get(item.nodeid):\r\n uuid = self._cache.push(item.nodeid)\r\n test_result = TestResult(name=item.name, uuid=uuid, start=now(), stop=now())\r\n self.allure_logger.schedule_test(uuid, test_result)\r\n yield\r\n\u003e self._update_fixtures_children(item)\r\n\r\n.nox/tests-3-10/lib/python3.10/site-packages/allure_pytest/listener.py:102: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n.nox/tests-3-10/lib/python3.10/site-packages/allure_pytest/listener.py:71: in _update_fixtures_children\r\n for fixturedef in _test_fixtures(item):\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n\r\nitem = \u003cFunction test_create_enum_metadata[options_bounds0]\u003e\r\n\r\n def _test_fixtures(item):\r\n fixturemanager = item.session._fixturemanager\r\n fixturedefs = []\r\n \r\n if hasattr(item, \"_request\") and hasattr(item._request, \"fixturenames\"):\r\n for name in item._request.fixturenames:\r\n\u003e fixturedefs_pytest = fixturemanager.getfixturedefs(name, item.nodeid)\r\nE AttributeError: 'str' object has no attribute 'iter_parents'\r\n\r\n.nox/tests-3-10/lib/python3.10/site-packages/allure_pytest/listener.py:345: AttributeError\r\n```\r\n\r\nAs it can be seen from the error message the following line is causing the issue: https://github.com/allure-framework/allure-python/blob/058a6afb0601f790162f058b3c1d3e7300d420ab/allure-pytest/src/listener.py#L102\r\n\r\nI believe this can be due to following change recently introduced in the `pytest` framework, because right after that, we upgraded to the latest `pytest` and our tests started to fail without even running (the error thrown during the initialization of the fixtures I believe). And downgrading to `pytest==8.0.0` fixed this issues. However, I think, it would be nice to fix this to make sure further compatability between `allure-pytest` and `pytest` framework. \r\n\r\nCommit from the `pytest`: https://github.com/pytest-dev/pytest/commit/434282e17f5f1f4fcc1464a0a0921cf19804bdd7\r\n\r\nP.S I am not exactly sure who should be responsible for handling this issue whether `allure` team or `pytest` team.\r\n\r\n[//]: # (\r\n. e.g. detailed explanation, stacktraces, related issues, suggestions \r\n. how to fix, links for us to have more context, eg. Stackoverflow, Gitter etc\r\n)\r\n","author":{"url":"https://github.com/mihhail-m","@type":"Person","name":"mihhail-m"},"datePublished":"2024-03-04T08:57:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/794/allure-python/issues/794"}
| 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:d365c007-d3c4-b9f6-52ce-ea2eb22cbd44 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE28:24B8AF:11BBB9:167BBC:69741EF4 |
| html-safe-nonce | 86a16af04fba88f900cd51effbd6d255603e36463cc79fc1ed4865982661f2e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTI4OjI0QjhBRjoxMUJCQjk6MTY3QkJDOjY5NzQxRUY0IiwidmlzaXRvcl9pZCI6IjMyMzgxNjY5MjkzMTg2MTY4MjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c945493e6dd83300b55942f59c9a68baf7ae80fb610e8e0f345d5dfbd1234c73 |
| hovercard-subject-tag | issue:2166303106 |
| 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/794/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39e23b828582597d683000e75e15f034651d011a5e87b5e491f0e3791224b29d/allure-framework/allure-python/issues/794 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39e23b828582597d683000e75e15f034651d011a5e87b5e491f0e3791224b29d/allure-framework/allure-python/issues/794 |
| og:image:alt | I'm submitting a ... [*] bug report What is the current behavior? After pytest released its latest version 8.1.0 it suddenly started to break allure_listener plugin on fixtures initilization/teardo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mihhail-m |
| hostname | github.com |
| expected-hostname | github.com |
| None | 447dc9917c3d68d647a01abfdefe55ec7ee1785922136c1d8395dbb3ab6d57b9 |
| 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 | 8dad7bdfecbe3eaa97ac4e632d6b47e2b23e81d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width