From c393eb75a46bf73339299ab658173ef316283260 Mon Sep 17 00:00:00 2001 From: Ghanshyam Mann Date: Wed, 28 Dec 2022 23:17:58 -0600 Subject: [PATCH] Fix tox4 error tox.ini started failing with Tox4 which had some incompatible changes. One of them is to allow external command to run by adding them into allowlist_externals Fixing tox.ini for tox4 changes. Change-Id: I7bc7c98954395765f16cc943e5c826983db5dba0 --- tox.ini | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 13aaf5f1c0..8153979c81 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] minversion = 3.2.0 -skipsdist = True envlist = validate,py3,pep8,pip-install ignore_basepython_conflict=true @@ -14,11 +13,15 @@ commands = stestr run {posargs} [testenv:py38-check-uc] +allowlist_externals = + check-conflicts basepython = python3.8 deps = -r{toxinidir}/upper-constraints.txt commands = check-conflicts {toxinidir}/upper-constraints.txt {toxinidir}/upper-constraints-xfails.txt [testenv:py39-check-uc] +allowlist_externals = + check-conflicts basepython = python3.9 deps = -r{toxinidir}/upper-constraints.txt commands = check-conflicts {toxinidir}/upper-constraints.txt {toxinidir}/upper-constraints-xfails.txt @@ -27,9 +30,13 @@ commands = check-conflicts {toxinidir}/upper-constraints.txt {toxinidir}/upper-c commands = {posargs} [testenv:update] +allowlist_externals = + update-requirements commands = update-requirements {posargs} [testenv:generate] +allowlist_externals = + generate-constraints description = Regenerates upper-constraints.txt # Generate needs an unconstrained install to get new dependencies deps = -r{toxinidir}/requirements.txt @@ -37,17 +44,29 @@ deps = -r{toxinidir}/requirements.txt commands = generate-constraints {posargs: -b blacklist.txt -r global-requirements.txt -p python3.6 -p python3.7 -p python3.8 -p python3.9 -p python3.10 > upper-constraints.txt} [testenv:validate] +allowlist_externals = + validate-constraints commands = validate-constraints {toxinidir}/global-requirements.txt {toxinidir}/upper-constraints.txt {toxinidir}/blacklist.txt [testenv:validate-projects] +allowlist_externals = + validate-projects commands = validate-projects {toxinidir}/projects.txt # TODO remove once zuul reconfigured to run linters on gate [testenv:pep8] deps = {[testenv:linters]deps} -whitelist_externals = {[testenv:linters]whitelist_externals} -commands = {[testenv:linters]commands} +allowlist_externals = + bash +commands = + flake8 + bash -c "find {toxinidir}/tools \ + -type f \ + -name \*.sh \ + -print0 | xargs -0 bashate -v -iE006,E010" + bash -c 'sed -e "s,===,==," upper-constraints.txt > {envtmpdir}/safety-check.txt' + -safety check --json -r {envtmpdir}/safety-check.txt [testenv:linters] description = Perform linting @@ -55,7 +74,8 @@ deps = hacking>=1.0.0 bashate>=0.5.1 safety -whitelist_externals = bash +allowlist_externals = + bash commands = flake8 bash -c "find {toxinidir}/tools \ @@ -77,6 +97,8 @@ commands = bindep test usedevelop = False [testenv:docs] +allowlist_externals = + sphinx-build deps = -c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/upper-constraints.txt} -r{toxinidir}/doc/requirements.txt commands = sphinx-build -W -b html doc/source doc/build/html @@ -87,12 +109,16 @@ deps = . commands = python {toxinidir}/tools/check-install.py [testenv:requirements-check] +allowlist_externals = + {toxinidir}/playbooks/files/project-requirements-change.py deps = -r{toxinidir}/requirements.txt commands = {toxinidir}/playbooks/files/project-requirements-change.py --local {posargs} [testenv:babel] # Use the local upper-constraints.txt file +allowlist_externals = + {toxinidir}/tools/babel-test.sh deps = Babel commands = {toxinidir}/tools/babel-test.sh