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

Support for pytest 7.0.0? #251

Closed
pnkraemer opened this issue Feb 4, 2022 · 3 comments · Fixed by #255
Closed

Support for pytest 7.0.0? #251

pnkraemer opened this issue Feb 4, 2022 · 3 comments · Fixed by #255

Comments

@pnkraemer
Copy link

Hi,

Thanks a lot for coming up with a very useful package!

I was wondering: do you plan on on adding support for the newest pytest release? (7.0.0, https://github.com/pytest-dev/pytest/releases). I know I am super early, pytest 7 is quite fresh and I understand that there hasnt been a chance to update pytest-cases.
Part of the reasoning behind this issue is that I stay up-to-date on potential updates on this front :)

The issue

Currently, version 3.6.8 does not work with pytest 7 when parametrising cases.
I know that pytest-cases does not support pytest 7 officially (yet?), but if you want a MWE to reproduce some issues that come up in my application, see below.

To reproduce

(Patched together from https://docs.pytest.org/en/7.0.x/getting-started.html)

import pytest_cases
import pytest

def foo(a, b):
    return a + 1, b + 1

@pytest_cases.parametrize("x", (2,))  # the culprit
def case_two_positive_ints(x):
    """ Inputs are two positive integers """
    return 1, x


def case_two_negative_ints():
    """ Inputs are two negative integers """
    return -1, -2


@pytest_cases.parametrize_with_cases("a,b", cases=".")
def test_foo(a, b):
    assert isinstance(foo(a, b), tuple)

The above works with (pip freeze)

attrs==21.4.0
decopatch==1.4.8
iniconfig==1.1.1
makefun==1.13.1
more-itertools==8.12.0
packaging==21.3
pluggy==0.13.1
py==1.11.0
pyparsing==3.0.7
pytest==6.2.5  # old pytest
pytest-cases==3.6.8
toml==0.10.2
tomli==2.0.0

but does not work with

attrs==21.4.0
decopatch==1.4.8
iniconfig==1.1.1
makefun==1.13.1
more-itertools==8.12.0
packaging==21.3
pluggy==0.13.1
py==1.11.0
pyparsing==3.0.7
pytest==7.0.0  # new pytest
pytest-cases==3.6.8
toml==0.10.2
tomli==2.0.0

It raises the following error:
Screenshot from 2022-02-04 14-03-50

Thanks a lot!

If it helps: I can make a PR if pointed to the correct place.

@bhazelton
Copy link

We are seeing similar errors on our pyuvdata package (https://github.com/RadioAstronomySoftwareGroup/pyuvdata).

@smarie
Copy link
Owner

smarie commented Feb 8, 2022

Thanks for reporting @pnkraemer ! I'll ship a fix very shortly based on @jammer87 's PR

@smarie
Copy link
Owner

smarie commented Feb 8, 2022

3.6.9 is now released with the fix. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants