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

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

Open
adamchainz opened this issue Aug 24, 2016 · 14 comments

Comments

@adamchainz
Copy link
Contributor

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.

@wolever
Copy link
Owner

wolever commented Aug 24, 2016

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

@adamchainz
Copy link
Contributor Author

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

@wolever
Copy link
Owner

wolever commented Feb 5, 2019

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.

@adamchainz
Copy link
Contributor Author

Cool, thanks for your maintenance :)

@lingz
Copy link

lingz commented Feb 18, 2020

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

@asmeurer
Copy link

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.

@wolever
Copy link
Owner

wolever commented Jan 11, 2021

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

@nwdenton
Copy link

nwdenton commented Feb 8, 2021

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

@p-sto
Copy link

p-sto commented May 15, 2021

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

@werdlerk
Copy link

werdlerk commented Aug 3, 2021

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

@luis-chaves-visa
Copy link

Any chance this can be merged?

@sandrotosi
Copy link

@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
Copy link

ulzha commented Jul 27, 2023

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

@scottgigante
Copy link

Bumping again! 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
Development

No branches or pull requests