parameterized icon indicating copy to clipboard operation
parameterized copied to clipboard

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

Open adamchainz opened this issue 8 years ago • 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.

adamchainz avatar Aug 24 '16 10:08 adamchainz

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 ([email protected]) 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

wolever avatar Aug 24 '16 20:08 wolever

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

adamchainz avatar Aug 24 '16 21:08 adamchainz

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.

wolever avatar Feb 05 '19 18:02 wolever

Cool, thanks for your maintenance :)

adamchainz avatar Feb 06 '19 00:02 adamchainz

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

lingz avatar Feb 18 '20 14:02 lingz

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.

asmeurer avatar Jul 31 '20 07:07 asmeurer

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 avatar Jan 11 '21 00:01 wolever

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

nwdenton avatar Feb 08 '21 15:02 nwdenton

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

p-sto avatar May 15 '21 13:05 p-sto

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

werdlerk avatar Aug 03 '21 14:08 werdlerk

Any chance this can be merged?

luis-chaves-visa avatar May 27 '22 12:05 luis-chaves-visa

@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!

sandrotosi avatar Jul 08 '22 19:07 sandrotosi

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

ulzha avatar Jul 27 '23 10:07 ulzha

Bumping again! Thanks

scottgigante avatar Dec 18 '23 20:12 scottgigante