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

holger krekel hpk at trillke.net
Sat Mar 25 23:24:30 CET 2006


On Sat, Mar 25, 2006 at 20:13 +0100, Jan Balster wrote:
> 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
> >>
> >> Modified:
> >>    py/dist/py/test/cmdline.py
> >> Log:
> >> 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.
> 
> 
> A list would be better, how should main() know that 'filename with spaces.py' is
> one name? The shell would interpret 'filename\ with\ spaces.py' or '"filename
> with spaces.py"' as one name with spaces (but we do not want to reimplement
> this). We should let the shell/user(who uses main directly) do the escaping
> stuff and let main work with a list.

We could probably decide on the input type we get, i guess. 
I don't know if optparse can do the splitting into arguments
good enough, though. OTOH, for programmatically invoking 
the py.test cmdline it is not so bad to push the decision
to the caller. 

    holger



More information about the Pytest-dev mailing list