From 5bc5127cc99be8b86dce266c1060bf32651bbc8b Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 18 Sep 2025 12:04:06 +0100 Subject: [PATCH] tox: Assorted changes - Remove the 'linters' testenv: this battle has been lost - Don't install package for the 'pep8' testenv: it's unnecessary - Remove 'safety' from 'pep8' testenv: the command we were using is deprecated and the new one requires authentication - Fix the 'bindep' testenv so it (once again) skips install of the package and do the same for the 'pep8' and 'babel' testenvs - Stop setting 'basepython': everything is Python 3 nowadays (tox 4 *only* supports that) - Remove a linter from the 'test-requirements.txt' file: these dependencies are managed by tox - Fix some indentation Change-Id: I4805d1ac0fa0209c59f3815352ff9ea54108eca2 Signed-off-by: Stephen Finucane --- test-requirements.txt | 1 - tox.ini | 64 ++++++++++++++++--------------------------- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index bc9ec5a31a..69ff89422d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,4 +4,3 @@ stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT virtualenv>=14.0.6 # MIT -bashate>=0.5.1 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 404bf9e842..d0a0fc3c9f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,13 @@ [tox] minversion = 4.11.0 envlist = validate,py3,pep8,pip-install -ignore_basepython_conflict=true [testenv] -basepython = python3 -usedevelop = True -deps = -c{toxinidir}/upper-constraints.txt - -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +usedevelop = true +deps = + -c{toxinidir}/upper-constraints.txt + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt commands = stestr run {posargs} @@ -40,59 +39,42 @@ allowlist_externals = generate-constraints description = Regenerates upper-constraints.txt # Generate needs an unconstrained install to get new dependencies -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt commands = generate-constraints {posargs: -d denylist.txt -r global-requirements.txt -p python3.9 -p python3.10 -p python3.11 -p python3.12 -p python3.13 > upper-constraints.txt} [testenv:validate] allowlist_externals = validate-constraints commands = - validate-constraints {toxinidir}/global-requirements.txt {toxinidir}/upper-constraints.txt {toxinidir}/denylist.txt + validate-constraints {toxinidir}/global-requirements.txt {toxinidir}/upper-constraints.txt {toxinidir}/denylist.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} -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 +skip_install = true deps = - hacking>=1.0.0 - bashate>=0.5.1 - safety + hacking~=7.0 # Apache-2.0 + bashate~=2.1 # Apache-2.0 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 + flake8 + bash -c "find {toxinidir}/tools \ + -type f \ + -name \*.sh \ + -print0 | xargs -0 bashate -v -iE006,E010" [testenv:bindep] # Do not install any requirements. We want this to be fast and work even if # system dependencies are missing, since it's used to tell you what system -# dependencies are missing! This also means that bindep must be installed -# separately, outside of the requirements files, and develop mode disabled -# explicitly to avoid unnecessarily installing the checked-out repo too (this -# further relies on "tox.skipsdist = True" above). +# dependencies are missing! +skip_install = true deps = bindep commands = bindep test usedevelop = False @@ -100,12 +82,13 @@ usedevelop = False [testenv:docs] allowlist_externals = sphinx-build -deps = -c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/upper-constraints.txt} - -r{toxinidir}/doc/requirements.txt +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 [testenv:pip-install] -recreate = True +recreate = true deps = . commands = python {toxinidir}/tools/check-install.py @@ -117,6 +100,7 @@ commands = {toxinidir}/playbooks/files/project-requirements-change.py --local {posargs} [testenv:babel] +skip_install = true # Use the local upper-constraints.txt file allowlist_externals = {toxinidir}/tools/babel-test.sh