Update tox.ini to work with python3.9 and tox 4

This change combines the following commits from `master`:

  commit 932ff63d6d
  Author: Al Bailey <al.bailey@windriver.com>
  Date:   Tue Dec 27 01:29:24 2022 +0000
    Update tox.ini to work with tox 4
  Signed-off-by: Al Bailey <al.bailey@windriver.com>

  commit 4d34b1ac65
  Author: Thiago Brito <thiago.brito@windriver.com>
  Date:   Wed Jun 22 12:27:57 2022 -0300
    Add flake8-import-order and use python3.9 on tox
  Signed-off-by: Thiago Brito <thiago.brito@windriver.com>

So that this repo is able to pass Zuul's tests and remain maintainable.

Signed-off-by: Luan Nunes Utimura <LuanNunes.Utimura@windriver.com>
Change-Id: Id3fc303e6febdbe434bb3e3b70d8e4e94cc098ed
(cherry picked from commit 932ff63d6d)
(cherry picked from commit 4d34b1ac65)
This commit is contained in:
Luan Nunes Utimura 2022-12-27 01:29:24 +00:00
parent 88aab7bb87
commit c36c729f60
5 changed files with 43 additions and 27 deletions

View File

@ -5,16 +5,26 @@
- stx-release-notes-jobs
check:
jobs:
- openstack-tox-pep8
- openstack-tox-linters
- stx-upstream-tox-pep8
- stx-upstream-tox-linters
gate:
jobs:
- openstack-tox-pep8
- openstack-tox-linters
- stx-upstream-tox-pep8
- stx-upstream-tox-linters
post:
jobs:
- stx-upstream-upload-git-mirror
- job:
name: stx-upstream-tox-pep8
parent: openstack-tox-pep8
nodeset: debian-bullseye
- job:
name: stx-upstream-tox-linters
parent: openstack-tox-linters
nodeset: debian-bullseye
- job:
name: stx-upstream-upload-git-mirror
parent: upload-git-mirror

View File

@ -3,6 +3,7 @@ import fnmatch
import os
import resource
import subprocess
from django.conf import settings

View File

@ -12,10 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
from keystone.server import wsgi as wsgi_server
import sys
sys.argv = sys.argv[:1]
application = wsgi_server.initialize_public_application()

View File

@ -1,4 +1,5 @@
bashate >= 0.2
PyYAML >= 3.1.0
yamllint >= 0.5.2
flake8 >= 2.5.4 # MIT
bashate
PyYAML
yamllint
flake8
flake8-import-order

39
tox.ini
View File

@ -4,7 +4,12 @@ minversion = 2.3
skipsdist = True
[testenv]
install_command = pip install -U {opts} {packages}
basepython = python3.9
install_command = pip install \
-v -v -v \
-U \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
@ -12,8 +17,7 @@ setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
basepython = python3
whitelist_externals = bash
allowlist_externals = bash
commands =
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
@ -27,17 +31,6 @@ commands =
-o -name '*.yaml' \
-print0 | xargs -0 yamllint"
[testenv:pep8]
basepython = python3
usedevelop = False
description =
Run style checks.
commands =
flake8
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# E501 skipped because some of the code files include templates
@ -46,10 +39,20 @@ commands =
show-source = True
ignore = E123,E125,E501,H405
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
import-order-style = google
[testenv:pep8]
usedevelop = False
description =
Run style checks.
commands =
flake8
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:docs]
@ -58,7 +61,7 @@ deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
whitelist_externals = rm
allowlist_externals = rm
[testenv:releasenotes]
basepython = python3
@ -66,13 +69,13 @@ deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
whitelist_externals =
allowlist_externals =
rm
reno
[testenv:newnote]
basepython = python3
# Re-use the releasenotes venv
basepython = python3
envdir = {toxworkdir}/releasenotes
deps = -r{toxinidir}/doc/requirements.txt
commands = reno new {posargs}