[TIP] pytest fixture autouse question
Chris.Pella at safenet-inc.com
Thu Jan 3 11:20:47 PST 2013
I may have a misunderstanding of when session-level autouse fixtures are called. I am trying to create a session level fixture that runs before once per test session before any class setup is called.
I have conftest.py file in the directory where the tests reside and in there I have some code that installs some client software on the test node. We only want to install the client once per session for all the test classes that get executed.
Installs client at the session level
client = InstallClient()
I assumed that this would execute prior to any test setup for a particular test class since it is a session level fixture, but I find that setup_class() executes before the clients get installed.
e.g. with some toy test code I find that the class setup gets executed before the fixture. This is not the behaviour I wanted or expected.
print "test one"
The information contained in this electronic mail transmission
may be privileged and confidential, and therefore, protected
from disclosure. If you have received this communication in
error, please notify us immediately by replying to this
message and deleting it from your computer without copying
or disclosing it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python