Jeff Balogh wrote:
> In...@Ja... wrote:
>
>> Jeff Balogh wrote:
>>
>>> Attached is a patch that replaces getopt with optparse.
>>>
>>> I like optparse because it's more maintainable, the order of the options doesn't
>>> matter, and you get the usage text for free.
>>>
>>>
>> (Replying to list.) Looks good. Committed in r180, with a minor tweak to
>> the usage for --unittest.
>>
>> -Matthias Miller
>>
>
> What is the purpose of running the unittests with `sys.argv[:1]`?
>
> if options.unittest:
> unittest.main(pyjsl.jsparse, argv=sys.argv[:1])
>
> If you only want to pass the program name, `sys.argv[0]` would be clearer.
> However, limiting argv to just the program name means you can't pass any command
> line arguments to unittest (it takes --quiet or --verbose).
>
> I think it would be best to not include any argv parameter, unless there's
> something I'm missing.
Granted, the splice is a bit unclear; tweaked in r184.
The problem is that both jsl.py and unittest.main are trying to parse
the same command-line, and they don't understand each other's options.
Right off, I'd suggest invoking the test loader/runner directly instead
of using unittest.main, and handling --quiet and --verbose in jsl.py. (I
don't see a big need to support running only certain tests until we have
more of them.)
|