hash / number sign cannot be escaped in tox.ini

Issue #181 on hold
Florian Ludwig created an issue

The tox.ini parser does not provide a way to use the #-character as it is always interpreted as comment-begin.

The built-in python ini parser avoids the problem altogether by allowing comments to only start at line beginning.

With pip urls often containing the character this breaks several use cases.

Comments (8)

  1. Holger Krekel repo owner

    Is this a problem for "deps" specifically? Just tried putting "#" in commands and that didn't cause problems. IOW, do you have a specific example?

    (i agree we should probably go do things similar as the default parser but doing that now might break existing tox.ini files so i'd like to see how we can best advance now).

  2. Florian Ludwig reporter

    The current parser does ignore everything after # without a way to escape it.

    Good for:

    python test.py  # execute python test script
    

    Bad for:

    python -c 'print "i like # in my command"'
    
  3. Holger Krekel repo owner

    Fixes bug 181; allow # in commands

    If a # was in a command the original code naively removed it and
    everything after assuming it was a comment. This meant that a #
    could not be used in a command even if it was quoted or escaped.

    This fix is backward incompatible because it no longer allows a
    comment to appear after a line escape (). I think is is acceptable
    because in most other environments a backslash would preceed a
    newline to escape it and tell the interpreter to ignore it. This
    brings tox's command behavior more in line with what Unix shells
    or Python actually do.

    → <<cset 267db03b41e9>>

  4. Log in to comment