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

Positional args are not passed to fetch-charms target #287

Open
jadonn opened this issue Aug 22, 2023 · 0 comments
Open

Positional args are not passed to fetch-charms target #287

jadonn opened this issue Aug 22, 2023 · 0 comments

Comments

@jadonn
Copy link

jadonn commented Aug 22, 2023

I may be using the wrong version of Tox, but when I tried to run tox with the fetch-charms target Tox the positional args were not passed to fetch-charms.py. The positional args were consumed by Tox. This command, for example, returned the help from Tox instead of fetch-charms.py

tox -e fetch-charms -h

I tried a few variations on running Tox and fetch-charms, like adding the -- after fetch-charms, since that appears to be what Tox expects. This did invoke fetch-charms, but fetch-charms was ignoring the input as in this example:

tox -e fetch-charms -- --section openstack
fetch-charms: commands[0]> python3 /home/jadon/work-projects/release-tools/fetch-charms.py -- --section openstack
usage: fetch-charms.py [-h] [--log {DEBUG,INFO,WARN,ERROR,CRITICAL}] --section SECTION [--charm CHARM]
                       [--ignore-charm IGNORE_CHARM] [--worktree WORKTREE] [--worktree-dir WORKTREE_DIR] [--branch BRANCH]
                       [--dir DIRECTORY] [--replace] [--ignore-failure] [--checkout-topic CHECKOUT_TOPIC]
                       [--skip-if-present] [--reuse]
fetch-charms.py: error: the following arguments are required: --section/-s
fetch-charms: exit 2 (0.05 seconds) /home/jadon/work-projects/release-tools> python3 /home/jadon/work-projects/release-tools/fetch-charms.py -- --section openstack pid=231871
  fetch-charms: FAIL code 2 (0.07=setup[0.02]+cmd[0.05] seconds)
  evaluation failed :( (0.10 seconds)

If I did the command without -- I got the following:

tox -e fetch-charms --section openstack
usage: tox [-h] [--colored {yes,no}] [-v | -q] [--exit-and-dump-after seconds] [-c file] [--workdir dir] [--root dir] [--runner {virtualenv}] [--version] [--no-provision [REQ_JSON]] [--no-recreate-provision] [-r] [-x OVERRIDE]
           {run,r,run-parallel,p,depends,de,list,l,devenv,d,config,c,quickstart,q,exec,e,legacy,le} ...
tox: error: unrecognized arguments: --section openstack
hint: if you tried to pass arguments to a command use -- to separate them from tox ones

I was able to run Tox with the fetch-charms target by removing the -- from the declaration in tox.ini for the target testenv:fetch-charms. This declaration made fetch-charms work for me:

[testenv:fetch-charms]
basepython = python3
deps = -r{toxinidir}/requirements.txt
commands = python3 {toxinidir}/fetch-charms.py {posargs}

I am using Tox 4, but I got this same behavior on Tox 3. Am I missing something or do I need to update tox.ini to remove the -- before {posargs}?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant