[PEAK] [setuptools] Logging

Nikolaus Rath Nikolaus at rath.org
Thu Apr 15 17:47:23 EDT 2010


On 04/15/2010 04:14 PM, P.J. Eby wrote:
> At 03:36 PM 4/15/2010 -0400, Nikolaus Rath wrote:
>> I want to initialize the logging
>> module, and the -q and -v options of setup.py do not help at all, since
>> they only deal with distutil's and unittest's logging.
>>
>> Therefore I want to add a *new* option (either to setup.py or to the
>> "test" command) that initializes the logging module. My question is: how
>> do I do that?
> 
> Oh.  You'd have to subclass the test command for that, at least if you
> want access to command line parameters.

Ah, ok. But how would I add the additional parameters? Can I do

class MyTest(setuptools.Command.Test):
    user_options.append(('--log-level', logging.INFO,
                      "Log level for test cases"))

without defining user_options first? But I suppose a definiton would
completely override the parent-class definition...


>  But if you just want some code
> to initialize the logging module to a standard setting, why not just
> define a test suite in a module that does the initialization when imported?

Because that way I wouldn't be able to specify the log level on the
command line.

Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C


More information about the PEAK mailing list