-
Notifications
You must be signed in to change notification settings - Fork 19
Description
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}?