On Nov 14, 10:46 am, Alberto Valverde <[EMAIL PROTECTED]> wrote:
> Alberto Valverde wrote:
> > What I do in this case is to use separate config file to run unit-tests
> > and check for that in websetup.py:
>
> > def setup_config(command, filename, section, vars):
> >     """Place any commands to setup joborama here"""
> >     conf = appconfig('config:' + filename)
> >     load_environment(conf.global_conf, conf.local_conf)
>
> >     # at this point pylons.config is already populated. You could also
> >     # peek in it for test config options...
>
> >     if 'test' in filename:
> >         # setup environment for tests
> >     elif 'foo' in filename:
> >         # set up environment for fooing
> >     ....
>
> > This allows you to have separate configuration for each kind of tests,
> > for development, production, staging etc.. and setup the environment
> > accordingly in each case.
>
> I forgot to add that you'd also need to change app/tests/__init__.py so
> the config file 'test.ini' is not hardcoded but retrieved from
> os.environ or something so you can choose the testing config dynamically.

Thanks, looks good. I'll follow your example.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to