Re: [Python-Dev] Problems with regrtest and with logging

2011-05-13 Thread Éric Araujo
On Sat, May 7, 2011 at 3:51 AM, Éric Araujo wrote: > regrtest helpfully reports when a test leaves the environment unclean > (sys.path, os.environ, logging._handlerList) A quick follow-up: I talked about regrtest with RDM on IRC, and I will use the context manager that detects changes in the “if

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-13 Thread Éric Araujo
Le 11/05/2011 21:45, Vinay Sajip a écrit : > Éric Araujo netwok.org> writes: >> I thought that if we set the level on the logger, we would prevent >> third-party code to get some messages. E.g., we set level to INFO but >> pip uses some packaging functions and would like to get DEBUG message

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-11 Thread Vinay Sajip
Éric Araujo netwok.org> writes: > I thought that if we set the level on the logger, we would prevent > third-party code to get some messages. E.g., we set level to INFO but > pip uses some packaging functions and would like to get DEBUG messages. Then pip can set the level of the packaging

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-11 Thread Éric Araujo
Hi, That's right, though it's OK to provide a documented convenience API for adding handlers. I think I’ll aim for simplicity. We’ll document that we use the logger “packaging” throughout and let people use getLogger and addHandler with that. You don't necessarily need to set the level

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-09 Thread Vinay Sajip
Éric Araujo netwok.org> writes: > Yep, probably dead code. I think that an handler should be defined > only once, in the “if __name__ == '__main__'” block. Am I right? Just > like you don’t call sys.exit from library code (hello optparse!), you > don’t set logging handlers in library c

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-09 Thread Éric Araujo
Hi, When it comes to containers, identity matters at least as much as value does (and sometimes more so - e.g. sys.modules). Replacing those global containers with new ones isn't guaranteed to work, as they may be cached in various places rather than always retrieved fresh from the relevant modu

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-09 Thread Éric Araujo
Hi, Thanks for the help. I didn’t know about handler.close. (By which I mean that I used logging without re-reading its documentation, which is a testimony to its usability :) The cases you refer to seem to be _set_logger in packaging/run.py (which appears not to be used at all - there app

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-09 Thread Nick Coghlan
On Sat, May 7, 2011 at 3:51 AM, Éric Araujo wrote: > regrtest helpfully reports when a test leaves the environment unclean > (sys.path, os.environ, logging._handlerList), but I think the implementation > is buggy: it compares object identity and then value.  Why is comparing > identity useful?  I’

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-08 Thread Vinay Sajip
Éric Araujo netwok.org> writes: > The code is on https://bitbucket.org/tarek/cpython, in Lib/packaging. The cases you refer to seem to be _set_logger in packaging/run.py (which appears not to be used at all - there appear to be no other references to it in the code), Dispatcher.__init__ in pack

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-07 Thread Éric Araujo
Hi, Le 06/05/2011 22:07, R. David Murray a écrit : On Fri, 06 May 2011 19:51:31 +0200, =?UTF-8?Q?=C3=89ric_Araujo?= wrote: regrtest helpfully reports when a test leaves the environment unclean (sys.path, os.environ, logging._handlerList), but I think the implementation is buggy: it compares o

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-07 Thread Éric Araujo
Le 06/05/2011 20:57, Vinay Sajip a écrit : Éric Araujo netwok.org> writes: Second: in packaging, we have two modules that create a logging handler. I’m not sure how if we should change the code or fix the tests to restore the _handlerList, or how. If you are saying this happens in your

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-06 Thread R. David Murray
On Fri, 06 May 2011 19:51:31 +0200, =?UTF-8?Q?=C3=89ric_Araujo?= wrote: > regrtest helpfully reports when a test leaves the environment unclean > (sys.path, os.environ, logging._handlerList), but I think the > implementation is buggy: it compares object identity and then value. > Why is comparing

Re: [Python-Dev] Problems with regrtest and with logging

2011-05-06 Thread Vinay Sajip
Éric Araujo netwok.org> writes: > Second: in packaging, we have two modules that create a logging > handler. I’m not sure how if we should change the code or fix the tests > to restore the _handlerList, or how. If you are saying this happens in your unit tests for packaging, then you can

[Python-Dev] Problems with regrtest and with logging

2011-05-06 Thread Éric Araujo
Hi, Sorry for quick email-battery dying. regrtest helpfully reports when a test leaves the environment unclean (sys.path, os.environ, logging._handlerList), but I think the implementation is buggy: it compares object identity and then value. Why is comparing identity useful? I’d just use ==