[TIP] pytest: Setup/TearDown with fixtures

Максим Харандзюк max.kharandziuk at gmail.com
Tue Sep 2 06:58:05 PDT 2014


Sorry, maybe my opinion is a kind of oftopic but I think there is no reason
to use fixtures at all. Instead of fixtures you should use factory_boy
<http://factoryboy.readthedocs.org/en/latest/> library(or similar).

As I said it is just IMHO and maybe I miss some scenario when there is no
way to avoid fixtures(for example, when you don't use ORM). But I think
those cases are rare.


2014-09-02 16:14 GMT+03:00 Laszlo Papp <lpapp at kde.org>:

> Hi,
> I am sorry about bringing up another frustration with the official
> documentation, but ...
> It does not seem simple and easy to write a test class and have setup
> and teardown methods with fixtures. The documentation properly
> demonstrates a working version of the "old way"; so far so good.
> Yet, I thought being narrow-minded would not be fair, so I gave a try
> to the "new way", but I just failed in every way possible that I have
> tried. I found some chunk code snippets on Stack Overflow and in the
> official documentation, but they are not good.
> I could not find any dedicated example explaining how to achieve such
> a simple use case with the "new shiny way". I think the documentation
> would need some improvement in pytest. I simply cannot get my head
> around to this easily, so I just give up for now since I have to
> proceed...
> Currently, I am reverting myself to the "old way", but if you
> advertise the "new way" that much, at least give an example for the
> generic and common use case (IMHO) that people, including me, have
> used in other frameworks and languages. Otherwise, it is just
> non-working hype, IMHO. Sorry, I do not like "new shiny ways" that do
> not just work.
> Cheers, L.
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

С уважением,
Максим Харандзюк
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20140902/f51a2132/attachment.html>

More information about the testing-in-python mailing list