From https://github.com/smarie/python-pytest-cases/issues/71
When the user writes from pytest_cases import pytest_fixture_plus in his conftest.py, the symbol is mistakenly thought as being a plugin hook by pytest, because the symbol name starts with pytest_.
My question is therefore simple: what is the recommended way to fix this issue in pytest_cases without renaming the symbol ?
My question is therefore simple: what is the recommended way to fix this issue in pytest_cases without renaming the symbol ?
I see you have provided of renaming the symbol in the issue... AFAIK there's no other workaround.
I guess it would be possible to add support in pluggy to somehow mark a symbol as "not a hook", but I'm not sure it is worth the effort, and this happens only in pytest for historical reasons: pluggy recommend marking hooks with the @hookimpl decorator instead of relying on the function prefix.
Closing for now, but feel free to follow up with further questions. 馃憤
It seems that I could decorate the symbols whose name starts with pytest_ with @pytest.hookimpl(optionalhook=True) to solve the issue.
Do you confirm that this would not have any other side effect ?
Note that would be very weird as these symbols are not hooks at all, they just have names starting with pytest_. But if it can solve the issue, I'll be happy to do it
another simple fix is to use import ... as fixture_plus
Yes I had noted that one https://github.com/smarie/python-pytest-cases/issues/71#issuecomment-575265235
But the effort in on the users side, that's why I would prefer the @pytest.hookimpl(optionalhook=True) way (more dirty, but on my side).
If you feel this could work at least for a few versions, I can plan a name transition.
as long as its also documented that this is a time bomb in the sense that its just waiting for someone to register a hook with that name
lets open a pluggy issue for marking something as NOT A HOOK