[TIP] py.test deprecating yield tests

Ronny Pfannschmidt opensource at ronnypfannschmidt.de
Wed Dec 7 12:53:29 PST 2016


Hi Randy,

the Problem with yield tests is, that they execute test code and setup
state at collection time, wich is a massive source of errors in any
complex case and just barely works in the simple case

back when py.test collected and executed tests as it discovered them,
that was fine, but its been quite a while now since py.test switched to
collect first, then execute (around the 2.0 release i think)

-- Ronny


Am Wed, 7 Dec 2016 15:32:12 -0500
schrieb Randy Syring <randy at thesyrings.us>:

> I recently received a bunch of warnings that py.test is deprecating 
> yield tests.  I found this PR:
> 
> https://github.com/pytest-dev/pytest/pull/1714
> 
> But there is no real commentary there about why they are being
> removed (other than they are "problematic") and what should be done
> to replace them.  I'm not really sure if this is problem for us or
> not, I'm currently going to just call the methods myself instead of
> yielding them.  But wondered if there was anyone else who has further
> insight into this decision who can comment.
> 
> Thanks.
> 
> *Randy Syring*
> Husband | Father | Redeemed Sinner
> 
> /"For what does it profit a man to gain the whole world
> and forfeit his soul?" (Mark 8:36 ESV)/
> 




More information about the testing-in-python mailing list