[TIP] nose test generators under py.test

Bruno Oliveira nicoddemus at gmail.com
Thu Feb 25 13:04:20 PST 2016


On Thu, Feb 25, 2016 at 5:57 PM Fred Drake <fred at fdrake.net> wrote:

> On Thu, Feb 25, 2016 at 3:06 PM, Bruno Oliveira <nicoddemus at gmail.com>
> wrote:
> > Just a small correction, py.test supports "setUp" and "tearDown", but
> only
> > for xUnit subclasses (otherwise they wouldn't work out of the box).
>
> This seems to be exactly where I've run into a problem, though:  I am
> using a
> unittest.TestCase-derived test class, and setUp / tearDown aren't being
> used.
>

I see, but that TestCase-derived test class was being created by a
generator-style test, right? Unfortunately generator-style tests in py.test
have some edge cases, and it has been said that there's no plans to improve
on that area because generator-style tests have been supplanted by
parametrized tests[1].

Sorry I didn't elaborate further, just wanted to clarify that
setUp/tearDown are supported for "normal" xUnit subclasses. :)

[1] http://pytest.org/latest/parametrize.html

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


More information about the testing-in-python mailing list