[TIP] nose test generators under py.test
fred at fdrake.net
Thu Feb 25 11:55:18 PST 2016
On Thu, Feb 25, 2016 at 12:20 PM, Randy Syring <randy at thesyrings.us> wrote:
> 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.
Thanks, Randy! That helped.
Another thing that contributed to bad test discovery was what appears to be
incorrect handling of the __test__ class attribute. A class that derives from
unittest.TestCase, but with __test__ = False in the class definition, is still
discovered as a source for tests. I don't think this should be considered a
test, given these comments on __test__:
Moving these classes into the generator functions that referred to them
worked around the discovery problem, but seems clunky. Using the same
class from more than one generator becomes problematic.
Fred L. Drake, Jr. <fred at fdrake.net>
"A storm broke loose in my mind." --Albert Einstein
More information about the testing-in-python