my module and unittest contend over commandline options...

Duncan Booth duncan.booth at invalid.invalid
Fri May 2 04:54:21 EDT 2008


chrisber <christophberendes at gmail.com> wrote:

> I've poked around to see if I could delete the options my earlier code
> consumed from the commandline buffer, before invoking unittest, but
> that seems klugy. Instead, I hardwired  in a testing config file name,
> that always has to be local. That works pretty well, but it leaves me
> wonderfing whether there would have been another clean way to allow
> both my test code and unittest to have options without interfering
> with one another.
> 

You can pass argv as a parameter to main(), so I think the best bet is 
simply to build up a new argv with the options that you want to pass 
through.

Another option would be to subclass unittest.TestProgram and override 
parseArgs, but you'd have to copy & modify it as it doesn't seem to have 
been designed to be easily extendable.



More information about the Python-list mailing list