
pytox - issue #10
shell commands with quotes or special characters are not executed right
What steps will reproduce the problem? 1. Add a shell command to tox.ini that either has an exclamation mark or has a quoted argument value containing white space 2. run tox
Here is a more specific example: you can checkout the source to wikir -- http://code.google.com/p/wikir/source/checkout -- then...
- remove setup.cfg so that there are no argument overrides to nose.
- change the test command in tox.ini to nosetests -v -a '!deferred' --with-doctest []
- run tox -e py26
What is the expected output? What do you see instead?
The command is not executed as it was entered into tox.ini
For the wikir example, the logs say that tox is running the same command but it doesn't appear to be. You can see the difference by running:
.tox/py26/bin/nosetests -v -a '!deferred' --with-doctest
The -a (attribute) plugin parses '!deferred' as run any test that does not have the deferred attribute or has a falsy deferred attribute. Hmm, I'm not sure what tox translated the command into but it results in running no test files, just doctests.
For more clues, you can try setting the test command in tox.ini to :
commands=nosetests -v -A "not deferred" --with-doctest []
which has a similar effect. Here, it seems that tox is not honoring the quotes; it is splitting on the whitespace as suggested by this error:
OSError: No such file /Users/kumar/dev/wikir/deferred"
What version of the product are you using? On what operating system?
tox 0.8 on Mac OS X
Please provide any additional information below.
Comment #1
Posted on Sep 20, 2010 by Happy ElephantIt's true that the internal parsing of the shell commands is naive - it splits on space. See http://code.google.com/p/pytox/source/browse/tox/_config.py#266 and http://code.google.com/p/pytox/source/browse/tests/test_config.py#144 for the current semantics. I guess we use logic/code from argparse or optparse to extend and fix that.
This will probably also fix the "!deferred" problem - because the "-a" attribute option really will be '"!deferred"' instead of the expected '!deferred'".
Comment #2
Posted on Sep 20, 2010 by Swift Oxbtw, I think you can just use shlex.split() from the stdlib: http://docs.python.org/library/shlex.html#shlex.split
Actually that would have the nice side effect that developers could put comments next to the command in tox.ini :)
Comment #3
Posted on Jan 9, 2011 by Quick WombatThis is in fact fixed by my patch for Issue #15, as verified in the extra test case I added to that issue.
Comment #4
Posted on Apr 28, 2011 by Happy Elephant(No comment was entered for this change.)
Status: Done
Labels:
Type-Defect
Priority-Medium