# Find last non-tryfirst nonwrapper method.
i = len(hookimpls) - 1
while (
i >= 0
and hookimpls[i].tryfirst
and not (hookimpls[i].hookwrapper or hookimpls[i].wrapper)
):
It seems to me that the correct statement in the while is rather
# Find last non-tryfirst nonwrapper method.
i = len(hookimpls) - 1
while (
i >= 0
and (hookimpls[i].tryfirst
or hookimpls[i].hookwrapper or hookimpls[i].wrapper)
):
I recently observed a strange issue in
pytest-cases
in conjunction with a fake hook mimickingpytest-repeat
.Basically, the problem is that a hook with
tryfirst=True
,wrapper=True
gets called after a plugin withtrylast=True
. See issue description here : https://github.com/smarie/python-pytest-cases/issues/302Could it be related with these lines ?
https://github.com/pytest-dev/pluggy/blob/136bbe8c98b66cbcefdc2438bf3c59705678249b/src/pluggy/_hooks.py#L542C1-L548C15
It seems to me that the correct statement in the while is rather
Am I correct ?