i figured it out, but end up having more questions on the "proper" way
to do things.

in my tests/__init__.py file, i wanted to enforce that the database
begins at a clean slate for every single test.  hence, i tried to
trigger the database creation code in setup_db() instead of setUp().
i did this by taking out the database creation code and put it in a
stand-alone file called lib/db_setup, and updated websetup.py and
tests/__init__.py to call these helper function to set up the db.
since i figure that the db creation code is called from setup_db(), i
no longer need to call setup-app, which broke the logging because it's
initialized in websetup.py.

so i think i have 2 options.  please enlighten me if there are better
methods:

1) call setup-app within my setup_db().  i m hesitant b/c i feel like
i should separate the two.  the app should be setup once with setUp()
and the database should be re-created with setup_db().  but i m
getting the feeling that this stance is impractical.
2) initialize logger with my tests/__init__.py so that i could isolate
websetup.py and tests/__init__.py.  but i might run into the problem
you were describing where the logging system would disable previously
instantiated instances.

any feedback is much appreciated.  thanks very much.



On May 18, 5:52 am, "Diez B. Roggisch" <[email protected]> wrote:
> On Monday, May 17, 2010 22:31:20 steve wrote:
> > still doesn't work.  this is so strange.  is this dependent on "python
> > setup.py test.ini"?  I took that part out from the tests/__init__.py
> > and created the db in the setup_db() instead of relying on calling
> > websetup.py with SetupCommand.  thanks.
>
> we have this piece of code in our test base class:
>
>             # this sucks, but the python logging system
>             # will disable all already instantiated loggers
>             # before configuring the system. Which just happened
>             # through the above code. So to make things
>             # work, we need to re-enable all the disabled
>             # handlers here.
>
>             for logger in logging.getLogger().manager.loggerDict.values():
>                 logger.disabled = False
>
> It might be  that for whatever reason, you configure twice as well. Try 
> putting
> the above into one of your tests & see if it subsequently spits out sql.
>
> If yes, go figure out where the confiuration is done twice. Putting a few
> breakpoints
>
>   import pdb; pdb.set_trace()
>
> into the logging-module helps.
>
> Diez
>
> --
> 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 
> athttp://groups.google.com/group/turbogears?hl=en.

-- 
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.

Reply via email to