[Python-Dev] unittest argv
Guido van Rossum
guido at python.org
Mon May 1 19:23:43 CEST 2006
On 5/1/06, John Keyes <john at integralsource.com> wrote:
> On 5/1/06, Guido van Rossum <guido at python.org> wrote:
> > Wouldn't this be an incompatible change? That would make it a no-no.
> > Providing a dummy argv[0] isn't so hard is it?
>
> It would be incompatible with existing code, but that code is
> already broken (IMO) by passing a dummy argv[0].
That's a new meaning of "broken", one that I haven't heard before.
It's broken because it follows the API?!?!
>I don't
> think fixing it would affect much code, because normally
> people don't specify the '-q' or '-v' in code, it is almost
> exclusively used on the command line.
Famous last words.
> The only reason I came across it was that I was modifying
> an ant task (py-test) so it could handle all of the named
> arguments that TestProgram.__init__ supports.
>
> If the list index code can't change, at a minimum the default value
> for argv should change from None to sys.argv.
No. Late binding of sys.argv is very important. There are plenty of
uses where sys.argv is dynamically modified.
> Are the tests for unittest.py?
Assuming you meant "Are there tests", yes: test_unittest.py. But it needs work.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list