Files
update/software/tox.ini
Joshua Kraitberg 9ce9a82cdb Notify vim on state change
USM has several async operations.  This change allows software to notify
VIM when those async operations complete.

It does this by using the existing listener functionality to trigger a
host-audit event in VIM via the sysinv API.

TEST PLAN
PASS: AIO-SX patch upgrade
PASS: AIO-SX patch downgrade
PASS: AIO-SX patch upgrade, pre-bootstrap
PASS: AIO-DX patch upgrade

Story: 2011045
Task: 52380
Depends-On: https://review.opendev.org/c/starlingx/config/+/952590
Change-Id: Id7b22f58040cbbf02a2e616a529a2b72a3970e80
Signed-off-by: Joshua Kraitberg <joshua.kraitberg@windriver.com>
2025-06-17 09:10:19 -04:00

172 lines
5.1 KiB
INI

#
# Copyright (c) 2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Tox is a tool for running tests in multiple virtualenvs.
#
# To run this, from the update repo root directory, execute the following:
# - Install python3.9: apt install python3.9 python3.9-pip python3.9-venv
# - Create a py39 venv: python3.9 -m venv .venv
# - Source the venv: source .venv/bin/activate
# - Install tox in the venv: pip install tox
# - Run tox: tox -c software/tox.ini
[tox]
envlist = bandit, cover, flake8, py39, pylint, shellcheck, bashate
minversion = 4
skipsdist = True
# Default value would be {work_dir}/.tmp
# Setting to /tmp makes paths shorter, preventing issues with long paths
temp_dir = /tmp/update_repo_tox
# Custom variables
stxdir = {toxinidir}/../..
exclude_dirs = .env,.venv,.git,.tox
exclude_dirs_glob = *.env*,*.venv*,*.git*,*.tox*
[testenv]
allowlist_externals =
bash
basepython = python3.9 # Matching debian bullseye, base OS used on STX
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/fault/fm-api/source
-e{[tox]stxdir}/config/tsconfig/tsconfig
-e{[tox]stxdir}/update/software
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt}
passenv =
XDG_CACHE_HOME
setenv = VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
OS_STDERR_CAPTURE=1
OS_STDOUT_CAPTURE=1
OS_TEST_TIMEOUT=60
PYTHONDONTWRITEBYTECODE=True
PYTHONHASHSEED=0
sitepackages = False
usedevelop = true
[testenv:bandit]
description =
Find common security issues in Python code
commands =
# Using --silent flag so bandit does not report on files with no issues
bandit --recursive --silent --exclude {[tox]exclude_dirs_glob},*tests* .
commands_post =
bandit --version
[testenv:cover]
description = Measures effectiveness of python tests
setenv =
{[testenv]setenv}
PYTHON=coverage run --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[flake8]
description =
Flake8 settings.
While some linters have separate configuration files,
flake8 configuration is integrated into Tox.
# Set max line length allowed in python scripts
max-line-length = 120
# List number of errors of each type
statistics = True
# Show code line that triggered the error
show-source = True
# H106: Don't put vim configuration in source files (off by default).
# H203: Use assertIs(Not)None to check for None (off by default).
enable-extensions = H106, H203
# TODO: Fix these errors and remove these error suppressions
# E402 module level import not at top of file => ~90 instances
# E501 line too long => ~15 instances
# H105 Don't use author tags => 1 instance
# H306 imports not in alphabetical order => ~80 instances
# H401: docstring should not start with a space => ~5 instances
# H404 multi line docstring should start without a leading new line => ~80 instances
# H405 multi line docstring summary not separated with an empty line => ~930 instances
extend-ignore = E402, E501, H105, H306, H401, H404, H405
[testenv:flake8]
description = Checks PEP8 style formatting in python scripts.
commands =
flake8 --extend-exclude {[tox]exclude_dirs} {posargs}
commands_post =
flake8 --version
[stestr]
description = Settings for testenv:py39 tox env
test_path=./software/tests
top_dir=./
group_regex=([^\.]*\.)*
[testenv:py39]
description = Run python unit tests using py39
basepython = python3.9
commands =
stestr run {posargs}
stestr slowest
# TODO: Review pylintrc configs and error suppressions
[testenv:pylint]
description =
Run pylint on update/software/software.
Configs in update/software/pylint.rc
commands =
pylint software --rcfile=./pylint.rc
[testenv:shellcheck]
description =
Runs a shell/bash linter on scripts with a shebang containing bash or sh
commands =
# Shellcheck does not have a recursive option. Needs to be run on each file individually.
bash -c "grep -Rl . -e '\#\!.*\(sh\|bash\)' --exclude-dir={{[tox]exclude_dirs}} | \
xargs --verbose --no-run-if-empty -I {} \
shellcheck {} \
"
commands_post =
# List files checked
bash -c "grep -Rl . -e '\#\!.*\(sh\|bash\)' --exclude-dir={{[tox]exclude_dirs}}"
shellcheck --version
[testenv:bashate]
description =
Runs a shell/bash formatting and style check on scripts with a shebang containing bash or sh
commands =
# Bashate does not have a recursive option. Needs to be run on each file individually.
bash -c "grep -Rl . -e '\#\!.*\(sh\|bash\)' --exclude-dir={{[tox]exclude_dirs}} | \
xargs --verbose --no-run-if-empty -I {} \
bashate --verbose --max-line-length 120 {} \
"
commands_post =
# List files checked
bash -c "grep -Rl . -e '\#\!.*\(sh\|bash\)' --exclude-dir={{[tox]exclude_dirs}}"
bashate --version