Thank you Massimo for the response.

os.environ["WEB2PY_USE_DB_TESTING"]= "1"   

is the correct way to set env. variables, and "modification of os.environ 
affect both the running program and subprocesses created by Python" (Python 
essential reference 4th ed.).

In my case after all, both ways are succeeding in transferring env 
variables to the models: either through passing a --config=MYCONFIG, or 
setting them in the setUP methods of unittest.TestCase subclasses. The 
problems were in the 'if' evaluation for the first case, and a restart of 
the shell in the second.. I chose finally the second method, as it does not 
create one more file (e.g. MYCONFIG.py) in the directories, and keeps the 
setting definition near where it belongs: at the unittest.TestCase 
construction.

-- 



Reply via email to