[TIP] pytest: Setup/TearDown with fixtures
Marcin.Tustin at dealertrack.com
Tue Sep 2 07:01:35 PDT 2014
The primary case when you can’t use an object factory is for integration testing, or unit testing code whose purpose is to make queries.
From: testing-in-python-bounces at lists.idyll.org [mailto:testing-in-python-bounces at lists.idyll.org] On Behalf Of ?????? ?????????
Sent: Tuesday, September 02, 2014 9:58 AM
To: Laszlo Papp
Cc: testing-in-python at lists.idyll.org
Subject: Re: [TIP] pytest: Setup/TearDown with fixtures
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<mailto:lpapp at kde.org>>:
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
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.
testing-in-python mailing list
testing-in-python at lists.idyll.org<mailto:testing-in-python at lists.idyll.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python