[TIP] pytest: Setup/TearDown with fixtures
lpapp at kde.org
Tue Sep 2 06:14:40 PDT 2014
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.
More information about the testing-in-python