-
-
Notifications
You must be signed in to change notification settings - Fork 533
tox fails when running in a path containing a hash #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
correct. Is it worth checking, are there any platforms that do not support Annoyingly this replacement does not occur within tox substitution system - instead it occurs in Removing diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py
index ea37bdc..8cc8137 100644
--- a/src/tox/config/__init__.py
+++ b/src/tox/config/__init__.py
@@ -1936,6 +1938,7 @@ class _ArgvlistReader:
# use all values as is in argv.
shlexer = shlex.shlex(newcommand, posix=True)
shlexer.whitespace_split = True
+ shlexer.commenters = ""
shlexer.escape = ""
return list(shlexer)
Only one test fails with the above, but there are way too many failure scenarios to seriously consider pre-processing the command so that '#' is correctly handled inside and outside of quotes. Internally, tox stores paths as py.path objects (deprecated), so it should be possible to delay resolution of them until the moment of shlexing, and then wrap them in quotes. However that approach is complicated by the fact that these objects go through the regex engine (re.sub), which requires bytes or str objects only. So, solving this seems to require adding quotes around path objects within the substitution engine, and then removing them before they are used in typical ways. They need to be removed after, otherwise the quotes appear everywhere especially in the cmdline UI and look ugly, and very likely breaking lots of plugins which are not expecting them. Hopefully this be slowly developed by activating this path quoting behaviour only when Small aside, I didn't quickly find a way for Fun fact [testenv:hashpath]
commands =
echo {envdir} results in an absolute path being shown on the reporter command, but the real command is not absolute. Anyone know if that bug has been raised, and/or if it is a regression and what the expected behaviour is?
|
Ah, #924 is another similar problem, with spaces in path. |
This looks like #1463, #1339, and perhaps others. Appears to have been an introduced change from absolute dirs prior to v3.8.0 |
Paths were already stored inside SectionReader._subs as path objects, however they are turned into strings when they go through Replacer, and various transforms occur on these paths, for example breaking paths containing '#' and ' '. This change defaults to path objects being retained through the Replacer, and path segments being joined together using path object joining semantics. This mode can be disabled for settings of type `path` by wrapping the value in quotes, and disabled for other values by disabling new global setting literal_paths. Fixes tox-dev#763 and tox-dev#924
Paths were already stored inside SectionReader._subs as path objects, however they are turned into strings when they go through Replacer, and various transforms occur on these paths, for example breaking paths containing '#' and ' '. This change defaults to path objects being retained through the Replacer, and path segments being joined together using path object joining semantics. This mode can be disabled for settings of type `path` by wrapping the value in quotes, and disabled for other values by disabling new global setting literal_paths. Fixes tox-dev#763 and tox-dev#924
I think this has now been fixed in v3, though I'm sure they'll be some edge cases that will surprise us due to this. |
On Archlinux with 2.9.1, when trying to run it in a folder called
test#foo
, I get:Nothing too special in tox.ini:
I'm guessing
{envpython}
gets replaced by the Python path (which contains a#
) and only after that, comments are stripped out?The text was updated successfully, but these errors were encountered: