[Numpy-discussion] Option parsing: tox and test-installed-numpy.py

Nathaniel Smith njs@pobox....
Sun Jul 8 13:38:03 CDT 2012


On Sun, Jul 8, 2012 at 7:30 PM, Chris Ball <s0454615@sms.ed.ac.uk> wrote:
> On Sun, Jul 8, 2012 at 6:52 PM, Nathaniel Smith <njs@pobox.com> wrote:
>> On Sun, Jul 8, 2012 at 6:44 PM, Chris Ball <s0454615@sms.ed.ac.uk> wrote:
>>> Hi,
>>>
>>> When calling tools/test-installed-numpy.py
>>> (https://github.com/numpy/numpy/blob/master/tools/test-installed-numpy.py),
>>> I can pass options to nose by supplying those options after "--", eg:
>>> $ python tools/test-installed-numpy.py -- --with-xunit
>>> (which passes "--with-xunit" to nose).
>>>
>>> NumPy's tox.ini (https://github.com/numpy/numpy/blob/master/tox.ini)
>>> uses tools/test-installed-numpy.py to run the tests. To pass options
>>> to test-installed-numpy.py when calling tox, I can pass the options
>>> after "--", eg:
>>> $ tox -- -v
>>> (which passes "-v" to test-installed-numpy.py).
>>>
>>> However, what I want to do is supply an option to tox that gets all
>>> the way through to nose! Is there a way I can do that, or do I need to
>>> edit tools/test-installed-numpy.py to have an option corresponding to
>>> nose's option?
>>
>> tox -- -- --with-xunit ?
>
> Thanks - I'd tried that (was just guessing), but it didn't work:
>
> $ tox -e py26 -- -- --with-xunit
> ...
> [TOX] numpy/.tox/py26$ bin/python numpy/tools/test-installed-numpy.py
> --with-xunit
> Usage: test-installed-numpy.py [options] -- [nosetests options]
>
> test-installed-numpy.py: error: no such option: --with-xunit
> [TOX] ERROR: InvocationError: 'bin/python
> numpy/tools/test-installed-numpy.py --with-xunit'
>
> If the double "--" is standard (is it?), maybe it's a problem with tox?

The double "--" isn't a standard, it's just what you get when you
compose the two rules you quoted in your original email :-).

"--" is supposed to mean, "stop doing option processing and treat
everything after this as positional arguments". So tox really should
see the first "--" and then treat the second as a positional argument.
Instead it is throwing the second one away. That is definitely a bug
in tox or whatever option parsing library it's using.

-N


More information about the NumPy-Discussion mailing list