Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@fixture incompatible with pytest 8.0.0 #330

Closed
jayqi opened this issue Jan 28, 2024 · 3 comments · Fixed by #335
Closed

@fixture incompatible with pytest 8.0.0 #330

jayqi opened this issue Jan 28, 2024 · 3 comments · Fixed by #335

Comments

@jayqi
Copy link
Contributor

jayqi commented Jan 28, 2024

pytest 8.0.0 just released earlier today, and it looks like there's an incompatibility with pytest_cases.fixture.

Minimal example:

from pytest_cases import fixture


@fixture
def a():
    return "a"


def test_a(a):
    assert a == "a"

pytest 7.4.4, pytest-cases 3.8.2, Python 3.11.7 — Passes ✅

pytest 8.0.0, pytest-cases 3.8.2, Python 3.11.7 — Fails ❌

Traceback:

.venv/lib/python3.11/site-packages/_pytest/nodes.py:152: in _create
    return super().__call__(*k, **kw)
.venv/lib/python3.11/site-packages/_pytest/python.py:1801: in __init__
    fixtureinfo = fm.getfixtureinfo(self, self.obj, self.cls)
.venv/lib/python3.11/site-packages/_pytest/fixtures.py:1490: in getfixtureinfo
    names_closure, arg2fixturedefs = self.getfixtureclosure(
E   TypeError: getfixtureclosure() got an unexpected keyword argument 'initialnames'

During handling of the above exception, another exception occurred:
.venv/lib/python3.11/site-packages/pluggy/_hooks.py:501: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.venv/lib/python3.11/site-packages/pluggy/_manager.py:119: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.11/site-packages/_pytest/python.py:277: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
.venv/lib/python3.11/site-packages/_pytest/python.py:486: in _genfunctions
    definition: FunctionDefinition = FunctionDefinition.from_parent(
.venv/lib/python3.11/site-packages/_pytest/python.py:1809: in from_parent
    return super().from_parent(parent=parent, **kw)
.venv/lib/python3.11/site-packages/_pytest/nodes.py:275: in from_parent
    return cls._create(parent=parent, **kw)
.venv/lib/python3.11/site-packages/_pytest/nodes.py:167: in _create
    return super().__call__(*k, **known_kw)
.venv/lib/python3.11/site-packages/_pytest/python.py:1801: in __init__
    fixtureinfo = fm.getfixtureinfo(self, self.obj, self.cls)
.venv/lib/python3.11/site-packages/_pytest/fixtures.py:1490: in getfixtureinfo
    names_closure, arg2fixturedefs = self.getfixtureclosure(
E   TypeError: getfixtureclosure() got an unexpected keyword argument 'initialnames'
@kdeldycke
Copy link

I can confirm the issue.

@connesy
Copy link

connesy commented Feb 2, 2024

Issue stems from this commit: pytest-dev/pytest@385796b

Running the example on the commit just before works fine. After this commit, I get the reported error.

nhuet added a commit to nhuet/decomon that referenced this issue Feb 5, 2024
There are breaking changes in pytest 8.0.0 that are not yet compatible
with pytest-cases fixtures: smarie/python-pytest-cases#330
ducoffeM pushed a commit to airbus/decomon that referenced this issue Feb 5, 2024
There are breaking changes in pytest 8.0.0 that are not yet compatible
with pytest-cases fixtures: smarie/python-pytest-cases#330
@smarie
Copy link
Owner

smarie commented Feb 7, 2024

Thanks a lot for reporting @jayqi ! For now inded the workaround is to use pytest<8.
I'll have a look in the upcoming weeks

Note: another user also mentioned that the symptom could be

AttributeError: 'MiniMetaFunc' object has no attribute `_arg2fixturedefs`

smarie pushed a commit that referenced this issue Mar 2, 2024
@smarie smarie mentioned this issue Mar 2, 2024
smarie pushed a commit that referenced this issue Mar 8, 2024
smarie added a commit that referenced this issue Mar 8, 2024
* WIP: Work on pytest 8

* In progress... towards #330

* Fixed compliance with pytest 8. Fixed #330

---------

Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Co-authored-by: Sylvain MARIE <sylvain.marie@se.com>
chaithyagr pushed a commit to chaithyagr/mri-nufft that referenced this issue Apr 11, 2024
Pytest-cases is not compatible yet.

Refs: smarie/python-pytest-cases#330
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants