[Python-Dev] Problems with regrtest and with logging
merwok at netwok.org
Sat May 7 18:28:21 CEST 2011
Le 06/05/2011 20:57, Vinay Sajip a écrit :
> Éric Araujo <merwok <at> 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
>> to restore the _handlerList, or how.
> If you are saying this happens in your unit tests for packaging, then
> you can
> either restore the _handlerList using the approach in test_logging,
> or else you
> can just close the handlers when you've done with them.
We create one handler in a command-line script, not in the lib, which
is the Right Way AFAIU, but there is also one module that creates one
handler (in order to set its level depending on a verbose attribute)
deep in the library code, not in the command-line script, which I think
is bad. Our tests that instantiate that object (dist.Distribution) end
up modifying logging._handlerList, but I feel that the code is wrong,
not the tests.
The code is on https://bitbucket.org/tarek/cpython, in Lib/packaging.
More information about the Python-Dev