Skip to content

Commit

Permalink
Revert getfixturedefs fix for pytest < 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Mar 4, 2024
1 parent 0201471 commit a423c40
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion allure-pytest/src/listener.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest
import doctest
from packaging import version

import allure_commons
from allure_commons.utils import now
from allure_commons.utils import uuid4
Expand Down Expand Up @@ -347,13 +349,23 @@ def _test_fixtures(item):

if hasattr(item, "_request") and hasattr(item._request, "fixturenames"):
for name in item._request.fixturenames:
fixturedefs_pytest = fixturemanager.getfixturedefs(name, item)
fixturedefs_pytest = _getfixturedefs(fixturemanager, name, item)
if fixturedefs_pytest:
fixturedefs.extend(fixturedefs_pytest)

return fixturedefs


def _getfixturedefs(fixturemanager, name, item):
# See pytest-dev/pytest#11785
itemarg = item if __is_pytest8_1_or_greater() else item.nodeid
return fixturemanager.getfixturedefs(name, itemarg)


def __is_pytest8_1_or_greater():
return version.parse(pytest.__version__) >= version.parse("8.1")


def _exception_brokes_test(exception):
return not isinstance(exception, (
AssertionError,
Expand Down

0 comments on commit a423c40

Please sign in to comment.