[TIP] nose test generators under py.test

Bruno Oliveira nicoddemus at gmail.com
Thu Feb 25 12:06:14 PST 2016


On Thu, Feb 25, 2016 at 2:23 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.
>

Just a small correction, py.test supports "setUp" and "tearDown", but only
for xUnit subclasses (otherwise they wouldn't work out of the box).

For normal classes (that don't subclass TestCase), py.test recognizes
"setup_method"/"teardown_method", "setup_class"/"teardown_class" and
"setup_module"/"teardown_module" for method, class and module level
fixtures[1].

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

Cheers,
Bruno.

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


More information about the testing-in-python mailing list