[py-dev] Re: [py-svn] r24998 - py/dist/py/test

Carl Friedrich Bolz cfbolz at gmx.de
Sun Mar 26 14:38:52 CEST 2006

Hi Brian!

Brian Dorsey wrote:
> On 25/03/06, cfbolz at codespeak.net <cfbolz at codespeak.net> wrote:
>>Author: cfbolz
>>Date: Sat Mar 25 16:34:53 2006
>>New Revision: 24998
>>   py/dist/py/test/cmdline.py
>>make driving py.test programmatically easier, by allowing to not use sys.argv.
>>User feature request.
> I like this idea, but I wonder if it a bit less magic to expect a list
> of args rather than splitting a string in main()? That way it would be
> easy to modify an existing copy of sys.argv or use the args from
> another option parsing library (like optparse) as well.

Huh? But a list or args works too, no?

def main(args=None):
     if args is None:
         args = py.std.sys.argv[1:]
     elif isinstance(args, basestring):
         args = args.split(" ")
     config, args = py.test.Config.parse(args)

If args is a list it is passed unchanched to parse. I agree that 
splitting a string is maybe too magical.


Carl Friedrich

More information about the Pytest-dev mailing list