[tox] minversion = 3.18.0 envlist = py3,pep8 #skipsdist = True # Automatic envs (pyXX) will only use the python version appropriate to that # env and ignore basepython inherited from [testenv] if we set # ignore_basepython_conflict. ignore_basepython_conflict = True [testenv] usedevelop = True basepython = python3 setenv = OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt commands = stestr run {posargs} allowlist_externals = stestr [testenv:pep8] deps = pre-commit commands = pre-commit run --all-files --show-diff-on-failure [testenv:bandit] # This command runs the bandit security linter against the openstackclient # codebase minus the tests directory. Some tests are being excluded to # reduce the number of positives before a team inspection, and to ensure a # passing gate job for initial addition. The excluded tests are: # B105-B107: hardcoded password checks - likely to generate false positives # in a gate environment # B401: import subprocess - not necessarily a security issue; this plugin is # mainly used for penetration testing workflow # B603,B606: process without shell - not necessarily a security issue; this # plugin is mainly used for penetration testing workflow # B607: start process with a partial path - this should be a project level # decision # NOTE(elmiko): The following tests are being excluded specifically for # python-openstackclient, they are being excluded to ensure that voting jobs # in the project and in bandit integration tests continue to pass. These # tests have generated issue within the project and should be investigated # by the project. # B110: try, except, pass detected - possible security issue; this should be # investigated by the project for possible exploitation # B605: process with a shell - possible security issue; this should be # investigated by the project for possible exploitation # B101: use of assert - this code will be removed when compiling to optimized # byte code commands = bandit -r openstackclient -x tests -s B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101 [testenv:unit-tips] commands = python -m pip install -q -U -e "git+file://{toxinidir}/../cliff#egg=cliff" python -m pip install -q -U -e "git+file://{toxinidir}/../keystoneauth#egg=keystoneauth" python -m pip install -q -U -e "git+file://{toxinidir}/../osc-lib#egg=osc_lib" pythom -m pip install -q -e "git+file://{toxinidir}/../openstacksdk#egg=openstacksdk" python -m pip freeze stestr run {posargs} allowlist_externals = stestr [testenv:functional] setenv = OS_TEST_PATH=./openstackclient/tests/functional passenv = OS_* commands = stestr run {posargs} [testenv:functional-tips] setenv = OS_TEST_PATH=./openstackclient/tests/functional passenv = OS_* commands = python -m pip install -q -U -e "git+file://{toxinidir}/../cliff#egg=cliff" python -m pip install -q -U -e "git+file://{toxinidir}/../keystoneauth#egg=keystoneauth1" python -m pip install -q -U -e "git+file://{toxinidir}/../osc-lib#egg=osc_lib" python -m pip install -q -U -e "git+file://{toxinidir}/../openstacksdk#egg=openstacksdk" python -m pip freeze stestr run {posargs} [testenv:venv] deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/doc/requirements.txt commands = {posargs} [testenv:cover] setenv = VIRTUAL_ENV={envdir} PYTHON=coverage run --source openstackclient --parallel-mode commands = stestr -q run {posargs} coverage combine coverage html -d cover coverage xml -o cover/coverage.xml [testenv:debug] passenv = OS_* commands = oslo_debug_helper -t openstackclient/tests {posargs} [testenv:docs] deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html sphinx-build -a -E -W -d doc/build/doctrees -b man doc/source doc/build/man # Validate redirects (must be done after the docs build whereto doc/build/html/.htaccess doc/test/redirect-tests.txt [testenv:releasenotes] deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] show-source = True exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,releasenotes # E203 Black will put spaces after colons in list comprehensions # E501 Black takes care of line length for us # H301 Black will put commas after imports that can't fit on one line # W503 and W504 are disabled since they're not very useful ignore = E203,E501,H301,W503,W504 import-order-style = pep8 application_import_names = openstackclient