Open
Description
tests\cases\issues\test_issue_269.py throws an exception during collection in most test environments with the following trace (modulo the env name)
.nox\tests-3-9-env-pytest-latest\lib\site-packages\pluggy\_hooks.py:433: in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
.nox\tests-3-9-env-pytest-latest\lib\site-packages\pluggy\_manager.py:112: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.nox\tests-3-9-env-pytest-latest\lib\site-packages\_pytest\python.py:271: in pytest_pycollect_makeitem
return list(collector._genfunctions(name, obj))
.nox\tests-3-9-env-pytest-latest\lib\site-packages\_pytest\python.py:498: in _genfunctions
self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
.nox\tests-3-9-env-pytest-latest\lib\site-packages\pluggy\_hooks.py:489: in call_extra
return self._hookexec(self.name, hookimpls, kwargs, firstresult)
.nox\tests-3-9-env-pytest-latest\lib\site-packages\pluggy\_manager.py:112: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.nox\tests-3-9-env-pytest-latest\lib\site-packages\_pytest\fixtures.py:1577: in pytest_generate_tests
metafunc.parametrize(
.nox\tests-3-9-env-pytest-latest\lib\site-packages\pytest_cases\plugin.py:910: in parametrize
raise ValueError("This should not happen - please file an issue")
E ValueError: This should not happen - please file an issue
Activity
smarie commentedon Sep 10, 2023
Indeed I am able to reproduce, thanks @jgersti for reporting !
The issue is due to the fact that our own version of
MetaFunc.parametrizeis not patched onto themetafuncobject early enough, and another plugin (my fake version of thepytest-repeatplugin used in tests) has already called the function.this should be called first:
python-pytest-cases/src/pytest_cases/plugin.py
Lines 851 to 862 in ab3b719
this should be called last:
python-pytest-cases/tests/pytest_extension/issues/test_issue_269.py
Lines 10 to 26 in ab3b719
But unfortunately the opposite happens.
This seems to come from a change in
pluggythat changed the meaning of thetry_firsttrylastandwrappermeanings. Most probably a bug I'd guess. I'll open an issue there.smarie commentedon Oct 1, 2023
Issue opened: pytest-dev/pluggy#441
Until the fix is available, we can mark the test as expected to fail.
EDIT : I commented the whole
tests/pytest_extension/issues/test_issue_269.pytest file, let's uncomment it when okWIP: Switched the backend to virtualenv. (#299)