Skip to content
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

Empty "{posargs:foo}" gets replaced by "." #240

Closed
pytoxbot opened this issue Sep 17, 2016 · 2 comments
Closed

Empty "{posargs:foo}" gets replaced by "." #240

pytoxbot opened this issue Sep 17, 2016 · 2 comments

Comments

@pytoxbot
Copy link

Given the following tox.ini:

#!ini
[tox]
skipsdist = true
[testenv]
commands = echo {posargs:foo}
whitelist_externals = echo

Just using tox outputs foo, but when trying to pass no positional arguments . (a single dot) get passed:

  % tox -- ""
  python runtests: PYTHONHASHSEED='456438988'
  python runtests: commands[0] | echo .
  .
  _____________________________________ summary ______________________________________
    python: commands succeeded
    congratulations :)
@pytoxbot
Copy link
Author

Original comment by @hpk42

fix issue240: allow to specify empty argument list without it being
rewritten to ".". Thanks Daniel Hahler.

→ <<cset 790d8f87af00>>

@pytoxbot
Copy link
Author

Original comment by @blueyed

This gets triggered by the args_are_paths setting, which defaults to true.

The following patch fixes it:

diff -r 6210dea5abf1 tox/_config.py
--- a/tox/_config.py    Tue Apr 28 09:10:54 2015 +0200
+++ b/tox/_config.py    Tue Apr 28 09:48:58 2015 +0200
@@ -373,9 +373,10 @@
             if vc.args_are_paths:
                 args = []
                 for arg in config.option.args:
-                    origpath = config.invocationcwd.join(arg, abs=True)
-                    if origpath.check():
-                        arg = vc.changedir.bestrelpath(origpath)
+                    if arg != '':
+                        origpath = config.invocationcwd.join(arg, abs=True)
+                        if origpath.check():
+                            arg = vc.changedir.bestrelpath(origpath)
                     args.append(arg)
             reader.addsubstitutions(args)
         setenv = {}

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant