-
Notifications
You must be signed in to change notification settings - Fork 40
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
parametrize implementation doesn't support infinite generators #148
Comments
Thanks @plammens ! Indeed, good catch. I'll fix this now |
Actually could you please provide a reproducible example that enters into this particular case ? Indeed it does not seem to happen import itertools
from pytest_cases import parametrize
@parametrize("foo", [1, 2], ids=("foo{%s}" % i for i in itertools.count()))
def test_dummy(foo):
pass I guess that it happens with some custom |
Ah! Should have mentioned that this happened only when parametrizing a fixture (i.e. |
Thanks @plammens for your reactivity. Fixing this now |
… also support infinite generators. Improved fix for #148
…r]`, it encompasses all cases we dupport for `ids`
Per the
pytest
documentation, theids
parameter ofpytest.mark.parametrize
also accepts a (possibly infinite) generator of ids, e.g.(f"foo{i}" for i in itertools.count())
. (This has the advantage of not having to care about keeping the lenght ofargvalues
andids
in sync.) However,pytest_cases
's custom managing of ids tries to consume the iterator all at once, hence causing the program to hang indefinitely at the collection stage:python-pytest-cases/pytest_cases/common_pytest.py
Line 227 in ae942d7
Reproducible example:
This happens even if we replace
pytest.mark.parametrize
withpytest_cases.parametrize
.The text was updated successfully, but these errors were encountered: