[TIP] running tests from pytest.main

Pella,Chris Chris.Pella at safenet-inc.com
Mon Jun 25 11:52:51 PDT 2012


We are invoking pytest using pytest.main from a custom functional test framework we are layering on top of pytest. It creates a global test configuration dictionary based on some command line switches and some config file data.  I was trying to prevent the global config dictionary from being re-initialized and making it a singleton by doing this:
if "config" not in dir(sys.modules[__name__]):
                config = {}
                ....

For some reason, when pytest is in control the above test of the sys.modules dict for the "config" name fails and the config dictionary is reinitialized and my config state is lost.  Oddly, we tried something similar on a colleagues machine using a python 2.6 ( I am using 2.7) and we didn't have that problem.

Any ideas what could be happening? I find it a bit hard to debug because when pytest is in control on my machine it seems that I can't interact with the eclipse console after a breakpoint is hit.

Chris


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...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20120625/cef5d55f/attachment.html>


More information about the testing-in-python mailing list