wolever/parameterized

Pytest 'yield tests are deprecated, and scheduled to be removed in pytest 4.0'

adamchainz opened this issue · 14 comments

This test leads to a pytest-warning on Pytest 3.0+:

from nose_parameterized import parameterized

@parameterized([
    ('foo',)
])
def test_foo(foo):
    pass

Like:

============================================================== pytest-warning summary ==============================================================
WC1 /path/to/test_foo.py yield tests are deprecated, and scheduled to be removed in pytest 4.0
=================================================== 1 passed, 1 pytest-warnings in 0.10 seconds ====================================================

Maybe the strategy for use within pytest should be reworked.

Ohh thanks!

Do you happen to know much about how py.test’s parameterization works so you could suggest a better implementation?

I’ve dug into it a bit, but I wasn’t able to figure out to my satisfaction.

On August 24, 2016 at 6:09:00 AM, Adam Chainz (notifications@github.com) wrote:

This test leads to a pytest-warning on Pytest 3.0+:

from nose_parameterized import parameterized

@parameterized([
('foo',)
])
def test_foo(foo):
pass
Like:

============================================================== pytest-warning summary ==============================================================
WC1 /path/to/test_foo.py yield tests are deprecated, and scheduled to be removed in pytest 4.0
=================================================== 1 passed, 1 pytest-warnings in 0.10 seconds ====================================================

Maybe the strategy for use within pytest should be reworked.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

-- 
https://twitter.com/wolever
(416) 906-0403
B230230D

I'm afraid I don't but I've done some pytest work so I'm a bit a familiar with its internals.

Okay, update: it's super ugly, but I believe I have things working with pytest 4 in this branch: https://github.com/wolever/parameterized/tree/pytest4

There's still a bit of cleanup + documentation to do, and to double check that it will correctly handle edge cases, but I believe it should be okay.

Cool, thanks for your maintenance :)

lingz commented

Hey @wolever any chance you would be able to merge the pytest4 branch into master?

Any update on this? It looks like parameterized doesn't work at all with the latest pytest. Decorated tests are marked with XFAIL and give warnings like PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_as_subindex_exhaustive will be ignored.

Hey folks! It's been a minute, but pytest4 should be wo

Please give it a try and let me know how it goes: pip install https://github.com/wolever/parameterized/archive/pytest4.zip

See also: https://github.com/wolever/parameterized/pull/116/files

If it all looks good, I'll merge + cut a new releas

@wolever do you think this will be merged in to a new release?

p-sto commented

Hi, still waiting for adding support. There's pytest 6 already.

I was also looking into why parameterized isn't working with Pytest.

Then I found it's included in Pytest (6). See for more info https://docs.pytest.org/en/6.2.x/parametrize.html

Any chance this can be merged?

@wolever any chance the fix for this issue can be merged and a new release cut? in debian we have pytest7 and parametrized tests are failing when running them via pytest -- thanks!

ulzha commented

Hey hey! Bumping this one, just in case it's fallen behind the cracks

Bumping again! Thanks