From 80e07ef73398cd0e26f1bb8eecc975f7014150c7 Mon Sep 17 00:00:00 2001 From: Hugo Brito Date: Fri, 25 Aug 2023 13:24:49 -0300 Subject: [PATCH] Update tox configuration for Distributed Cloud Cleanup the tox configuration and requirements. Test Plan: Verify that all Tox tests pass without errors. 1. Successfully executed on the distributedcloud dir - tox -e docs,releasenotes,api-ref,bandit,linters - tox -e newnote -- new-note 2. Successfully executed on the distributedcloud/distributedcloud dir - tox -e py39,pylint,pep8 Partial-Bug: 2033294 Change-Id: Ie7b2acb03c379708e8ef57b52d3c83560414f007 Signed-off-by: Hugo Brito --- distributedcloud/{pylint.rc => .pylintrc} | 2 +- distributedcloud/requirements.txt | 44 +++---- distributedcloud/test-requirements-debian.txt | 22 ---- distributedcloud/test-requirements.txt | 7 +- distributedcloud/tox.ini | 116 +++--------------- requirements.txt | 2 - test-requirements.txt | 3 - tox.ini | 57 ++------- 8 files changed, 48 insertions(+), 205 deletions(-) rename distributedcloud/{pylint.rc => .pylintrc} (99%) delete mode 100644 distributedcloud/test-requirements-debian.txt delete mode 100644 requirements.txt delete mode 100644 test-requirements.txt diff --git a/distributedcloud/pylint.rc b/distributedcloud/.pylintrc similarity index 99% rename from distributedcloud/pylint.rc rename to distributedcloud/.pylintrc index e7a20da36..658b61b7d 100644 --- a/distributedcloud/pylint.rc +++ b/distributedcloud/.pylintrc @@ -1,6 +1,6 @@ [MASTER] # Specify a configuration file. -rcfile=pylint.rc +rcfile=.pylintrc # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may diff --git a/distributedcloud/requirements.txt b/distributedcloud/requirements.txt index b68dcfa84..ffd949902 100644 --- a/distributedcloud/requirements.txt +++ b/distributedcloud/requirements.txt @@ -2,29 +2,12 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -# We have an older pbr which seems to work... -# pbr!=2.1.0,>=2.0.0 # Apache-2.0 -pbr >= 1.8 # Apache-2.0 -Babel!=2.4.0,>=2.3.4 # BSD - -Paste # MIT -PasteDeploy>=1.5.0 # MIT -Routes>=2.3.1 # MIT -debtcollector>=1.2.0 # Apache-2.0 -eventlet -pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 # BSD -greenlet>=0.3.2 # MIT -httplib2>=0.7.5 # MIT -requests!=2.12.2,!=2.13.0,>=2.10.0 # Apache-2.0 -Jinja2!=2.9.0,!=2.9.1,!=2.9.2,!=2.9.3,!=2.9.4,>=2.8 # BSD License (3 clause) +babel!=2.4.0,>=2.3.4 # BSD +eventlet # MIT +keyring # MIT keystonemiddleware>=4.12.0 # Apache-2.0 +kubernetes # Apache-2.0 netaddr!=0.7.16,>=0.7.13 # BSD -retrying!=1.3.0,>=1.2.3 # Apache-2.0 -SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT -WebOb>=1.7.1 # MIT -alembic>=0.8.10 # MIT -six>=1.9.0 # MIT -stevedore>=1.20.0 # Apache-2.0 oslo.concurrency>=3.29.1 # Apache-2.0 oslo.config>=4.0.0 # Apache-2.0 oslo.context>=2.14.0 # Apache-2.0 @@ -39,15 +22,22 @@ oslo.serialization>=1.10.0 # Apache-2.0 oslo.service>=1.10.0 # Apache-2.0 oslo.utils>=3.20.0 # Apache-2.0 oslo.versionedobjects>=1.17.0 # Apache-2.0 -sqlalchemy-migrate>=0.11.0 # Apache-2.0 +paste # MIT +pbr!=2.1.0,>=2.0.0 # Apache-2.0 +pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 # BSD +psutil # BSD +pycrypto>=2.6 # Public Domain python-openstackclient!=3.10.0,>=3.3.0 # Apache-2.0 python-barbicanclient>=4.5.2 python-neutronclient>=6.3.0 # Apache-2.0 python-cinderclient>=2.1.0 # Apache-2.0 python-novaclient>=7.1.0 # Apache-2.0 python-keystoneclient>=3.8.0 # Apache-2.0 -pycrypto>=2.6 # Public Domain -requests_toolbelt -keyring -kubernetes # Apache-2.0 -psutil +routes>=2.3.1 # MIT +requests!=2.12.2,!=2.13.0,>=2.10.0 # Apache-2.0 +requests_toolbelt # Apache-2.0 +retrying!=1.3.0,>=1.2.3 # Apache-2.0 +six>=1.9.0 # MIT +sqlalchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT +sqlalchemy-migrate>=0.11.0 # Apache-2.0 +webob>=1.7.1 # MIT diff --git a/distributedcloud/test-requirements-debian.txt b/distributedcloud/test-requirements-debian.txt deleted file mode 100644 index c6c0722d7..000000000 --- a/distributedcloud/test-requirements-debian.txt +++ /dev/null @@ -1,22 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. -hacking>=1.1.0,<=2.0.0 # Apache-2.0 -astroid== 2.11.5;python_version>"3.7" # GPLv2 -cliff>=2.6.0 # Apache-2.0 -coverage!=4.4,>=4.0 # Apache-2.0 -fixtures>=3.0.0 # Apache-2.0/BSD -mock>=2.0 # BSD -python-subunit>=0.0.18 # Apache-2.0/BSD -requests-mock>=1.1 # Apache-2.0 -sphinx # BSD -oslosphinx>=4.7.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD -testtools>=1.4.0 # MIT -testresources>=0.2.4 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD -WebTest>=2.0 # MIT -oslotest>=1.10.0 # Apache-2.0 -pylint==2.14.1;python_version>"3.7" # GPLv2 -PyYAML>=3.1.0 -yamllint<1.26.1;python_version>="3.0" # GPLv2 \ No newline at end of file diff --git a/distributedcloud/test-requirements.txt b/distributedcloud/test-requirements.txt index fa9cbe934..00a8c6f2e 100644 --- a/distributedcloud/test-requirements.txt +++ b/distributedcloud/test-requirements.txt @@ -2,23 +2,18 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. hacking>=1.1.0,<=2.0.0 # Apache-2.0 -astroid<= 2.2.5;python_version>="3.0" # GPLv2 cliff>=2.6.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0 # BSD python-subunit>=0.0.18 # Apache-2.0/BSD requests-mock>=1.1 # Apache-2.0 -sphinx # BSD -oslosphinx>=4.7.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testtools>=1.4.0 # MIT testresources>=0.2.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD WebTest>=2.0 # MIT oslotest>=1.10.0 # Apache-2.0 -pylint==1.9.2;python_version<"3.0" # GPLv2 -pylint==2.3.1;python_version>="3.0" # GPLv2 +pylint==2.14.1;python_version>"3.7" # GPLv2 PyYAML>=3.1.0 yamllint<1.26.1;python_version>="3.0" # GPLv2 -#python-dev-tools;python_version>="3.0" diff --git a/distributedcloud/tox.ini b/distributedcloud/tox.ini index 3378b9588..67b95322a 100644 --- a/distributedcloud/tox.ini +++ b/distributedcloud/tox.ini @@ -7,16 +7,15 @@ skipsdist = True toxworkdir = /tmp/{env:USER}_dctox [dc] -dc_base_dir = . - +stx_config_dir = ../../config stx_fault_dir = ../../fault -nfv_client_src_dir = ../../nfv/nfv/nfv-client + +cgcs_patch_src_dir = ../../update/sw-patch/cgcs-patch +cgtsclient_src_dir = {[dc]stx_config_dir}/sysinv/cgts-client/cgts-client fmclient_src_dir = {[dc]stx_fault_dir}/python-fmclient/fmclient fm_api_src_dir = {[dc]stx_fault_dir}/fm-api/source -tsconfig_src_dir = ../../config/tsconfig/tsconfig -cgtsclient_src_dir = ../../config/sysinv/cgts-client/cgts-client -cgcs_patch_src_dir = ../../update/sw-patch/cgcs-patch -stx_root_dir = ../../root +nfv_client_src_dir = ../../nfv/nfv/nfv-client +tsconfig_src_dir = {[dc]stx_config_dir}/tsconfig/tsconfig [testenv] basepython = python3.9 @@ -34,23 +33,21 @@ setenv = SINGLE_REPO=True OSLO_LOCK_PATH={toxinidir} -deps = -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt +deps = + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt + -e{[dc]cgcs_patch_src_dir} + -e{[dc]cgtsclient_src_dir} + -e{[dc]fmclient_src_dir} + -e{[dc]fm_api_src_dir} + -e{[dc]nfv_client_src_dir} + -e{[dc]tsconfig_src_dir} allowlist_externals = rm find - reno [testenv:py39] -deps = -r{toxinidir}/test-requirements-debian.txt - -r{toxinidir}/requirements.txt - keyring - -e{[dc]nfv_client_src_dir} - -e{[dc]tsconfig_src_dir} - -e{[dc]fmclient_src_dir} - -e{[dc]fm_api_src_dir} - -e{[dc]cgtsclient_src_dir} commands = find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete python setup.py testr --slowest --testr-args='{posargs}' @@ -59,23 +56,7 @@ commands = [testenv:pep8] commands = flake8 -[testenv:venv] -basepython = python3 -commands = {posargs} - - [testenv:cover] -install_command = pip install -v -v -v \ - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ - {opts} {packages} -deps = -r{toxinidir}/test-requirements-debian.txt - -r{toxinidir}/requirements.txt - keyring - -e{[dc]nfv_client_src_dir} - -e{[dc]tsconfig_src_dir} - -e{[dc]fmclient_src_dir} - -e{[dc]fm_api_src_dir} - -e{[dc]cgtsclient_src_dir} commands = coverage erase rm -Rf cover @@ -86,42 +67,7 @@ commands = coverage xml --rcfile=.coveragerc_xml coverage report -[testenv:docs] -basepython = python3 -install_command = pip install -U {opts} {packages} -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 -allowlist_externals = rm - -[testenv:releasenotes] -basepython = python3 -install_command = pip install -U {opts} {packages} -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 -allowlist_externals = rm - -[testenv:newnote] -basepython = python3 -# Re-use the releasenotes venv -envdir = {toxworkdir}/releasenotes -deps = -r{toxinidir}/doc/requirements.txt -commands = reno new {posargs} - -[testenv:api-ref] -basepython = python3 -install_command = pip install -U {opts} {packages} -deps = -r{toxinidir}/doc/requirements.txt -commands = - rm -rf api-ref/build - sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html -allowlist_externals = rm - [testenv:debug] -basepython = python3 commands = oslo_debug_helper {posargs} [flake8] @@ -138,13 +84,10 @@ show-source = True # E501 line too long # E731 do not assign a lambda expression, use a def # H216 flag use of third party mock -ignore = W503,W504,W605,H216, - E117,E123,E125,E305,E402,E501,E731 +ignore = W503,W504,W605,H216,E117,E123,E125,E305,E402,E501,E731 builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build [testenv:genconfig] -basepython = python3 commands = oslo-config-generator --config-file=tools/config-generator.conf @@ -152,33 +95,8 @@ commands = import_exceptions = dcmanager.common.i18n,dcorch.common.i18n [testenv:pylint] -deps = -r{toxinidir}/test-requirements-debian.txt - -r{toxinidir}/requirements.txt - -e{[dc]nfv_client_src_dir} - -e{[dc]tsconfig_src_dir} - -e{[dc]fmclient_src_dir} - -e{[dc]fm_api_src_dir} - -e{[dc]cgtsclient_src_dir} - -e{[dc]cgcs_patch_src_dir} - -install_command = pip install -v -v -v \ - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ - {opts} {packages} - setenv = {[testenv]setenv} PYTHONPATH = {toxinidir} commands = - pylint {posargs} dccommon dcmanager dcorch dcdbsync --rcfile=./pylint.rc - -[testenv:linters] -basepython = python3 -# bashate ignore: -# E006 - accept long lines -# E040 - false positive on |& syntax (new in bash 4) -allowlist_externals = bash -commands = - bash -c "find {toxinidir} \ - \( -name .tox -prune \) \ - -o -type f -name '*.yaml' \ - -print0 | xargs -r -0 yamllint" + pylint {posargs} dccommon dcmanager dcorch dcdbsync --rcfile=./.pylintrc diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e47d16906..000000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT -stevedore>=1.20.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 736d058e1..000000000 --- a/test-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -PyYAML>=3.1.0 -yamllint<1.26.1;python_version>="3.0" # GPLv2 -mock>=2.0 # BSD diff --git a/tox.ini b/tox.ini index 1605bad22..5fbf3f8c7 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ minversion = 2.3 skipsdist = True [testenv] +basepython = python3 install_command = pip install -v -v -v \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \ {opts} {packages} @@ -15,85 +16,51 @@ setenv = CURRENT_CFG_FILE={toxinidir}/.current.cfg commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete -deps = -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt - keyring - allowlist_externals = rm find reno -[testenv:venv] -basepython = python3 -commands = {posargs} - -[testenv:flake8] -basepython = python3 -description = Dummy environment to allow flake8 to be run in subdir tox - [testenv:pep8] -basepython = python3 description = Dummy environment to allow pep8 to be run in subdir tox [testenv:pylint] -basepython = python3 description = Dummy environment to allow pylint to be run in subdir tox -[testenv:pep8_Debian] -basepython = python3 -description = Dummy environment to allow pep8 to be run in subdir tox - -[testenv:pylint_Debian] -basepython = python3 -description = Dummy environment to allow pylint to be run in subdir tox - -[testenv:linters] -basepython = python3 -allowlist_externals = bash -commands = - bash -c "find {toxinidir} \ - \( -name .tox -prune \) \ - -o -type f -name '*.yaml' \ - -print0 | xargs -r -0 yamllint" - [testenv:docs] -basepython = python3 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 -allowlist_externals = rm [testenv:releasenotes] -basepython = python3 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 -allowlist_externals = - rm - reno [testenv:newnote] -basepython = python3 # Re-use the releasenotes venv envdir = {toxworkdir}/releasenotes deps = -r{toxinidir}/doc/requirements.txt commands = reno --rel-notes-dir {toxinidir}/releasenotes new {posargs} [testenv:api-ref] -basepython = python3 -deps = - -r{toxinidir}/doc/requirements.txt +deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html -allowlist_externals = rm [testenv:bandit] -basepython = python3 description = Bandit code scan for *.py files under config folder -deps = -r{toxinidir}/test-requirements.txt - bandit +deps = bandit commands = bandit -r {toxinidir}/ -x '**/.tox/**,**/.eggs/**' -lll + +[testenv:linters] +allowlist_externals = bash +deps = yamllint +commands = + bash -c "find {toxinidir} \ + \( -name .tox -prune \) \ + -o -type f -name '*.yaml' \ + -print0 | xargs -r -0 yamllint"