[TIP] nose test generators under py.test

Randy Syring randy at thesyrings.us
Thu Feb 25 09:20:28 PST 2016


I'm not sure if it makes a difference with generators, but I do know 
that py.test doesn't support "setUp" or "tearDown".  You have to use 
"setup" and "teardown" I believe.

*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)/

On 02/25/2016 12:14 PM, Fred Drake wrote:
> I've got a body of tests we've been running using nose (not nose2),
> and I'm looking at moving to py.test.  Mostly hasn't been a problem,
> as most of the tests are written using unittest.TestCase.
>
> We have a few cases where we're using generator functions to create
> test cases, with each case being a constructed unittest.TestCase
> instance.  py.test is getting these and running the __call__ method on
> them, but the setUp and tearDown methods aren't getting invoked; they
> are invoked under nose.
>
> Is my expectation that py.test will handle the generated
> unittest.TestCase instances the way nose does out of line?
>
> I'm using py.test 2.5.1 using the stock package on Ubuntu 14.04.
>
>
>    -Fred
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20160225/e0680336/attachment.htm>


More information about the testing-in-python mailing list