I like this, NIL. Please, do me one of two favors? 1: Fork the code, put in a patch, and send in a pull request (preferred, since it gives you credit in the history). 2; Submit a ticket.
Either way, I'd like this to go into 2.1.2. Your sending in a pull request will make that happen more easily, though. On Mon, Jun 20, 2011 at 3:06 PM, NiL <[email protected]> wrote: > Hi list > > in myproject.tests __init__ I had a TestController with a setup like > this (untouched) > > def setUp(self): > """Method called by nose before running each test""" > # Loading the application: > conf_dir = config.here > wsgiapp = loadapp('config:test.ini#%s' % > self.application_under_test, > relative_to=conf_dir) > self.app = TestApp(wsgiapp) > # Setting it up: > test_file = path.join(conf_dir, 'test.ini') > cmd = SetupCommand('setup-app') > cmd.run([test_file]) > > then I created several test_xxx.ini files for different test > conditions. My purpose was to be able to test the upgrade path for the > database structure from deployed versions of my app, up to the trunk > version. > > so in the setup_db function I wrote something like > > def setup_db(): > """Method used to build a database""" > engine = config['pylons.app_globals'].sa_engine > model.init_model(engine) > > if asbool(config['upgrade_test']): > #restore the production version structure of the DB > #upgrade the DB using sqlalchemy migrate > model.metadata.create_all(engine) > > > I run the tests (w/ jenkins) using a nosetests --with- > pylons=some_other_profile.ini > > BUT .... > > as test.ini is HARD CODED in TestController (sorry, no yelling, just > emphasing) > this leads to having functional test run against the wronf .ini > profile > > so I changed it to: > > def setUp(self): > """Method called by nose before running each test""" > # Loading the application: > conf_dir = config.here > wsgiapp=loadapp('config:%s#%s' % (config.__file__, > self.application_under_test)) > self.app = TestApp(wsgiapp) > # Setting it up: > test_file = config.__file__ > > cmd = SetupCommand('setup-app') > cmd.run([test_file]) > > and now all the tests run against the "good" profile > > > I use different profiles to run the tests in my development computer > and in the jenkins server > > so maybe, at spawning the app, this method of TestController should be > more flexible. > > NIL > > > -- > You received this message because you are subscribed to the Google Groups > "TurboGears" 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/turbogears?hl=en. > > -- Michael J. Pedersen My IM IDs: Jabber/[email protected], AIM/pedermj022171 Yahoo/pedermj2002, MSN/[email protected] My LinkedIn Profile: http://www.linkedin.com/in/michaeljpedersen Twitter: pedersentg -- You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en.

