[TIP] nose test generators under py.test

Fred Drake fred at fdrake.net
Thu Feb 25 09:14:35 PST 2016

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 L. Drake, Jr.    <fred at fdrake.net>
"A storm broke loose in my mind."  --Albert Einstein

More information about the testing-in-python mailing list