Sysinv tox updates. Prepare for bandit reports and test reports

The old sysinv py27 target did not use testrepository so its results
were not reported in jenkins. Now it will.
The bandit target will now output to an xml file which can be parsed and
reported in jenkins.

Note:  running tox for sysinv will reports warnings about missing
fmClientUI and missing ceph. this is acceptable as neither of those are
installed in the tox environment, and are side effects of using fm-api

Change-Id: I48c74e9a62cd6fd32ceb71e1994c55fa7e8c42cf
This commit is contained in:
Al Bailey 2018-04-30 13:23:17 -05:00 committed by Jack Ding
parent 06e2aa8e3d
commit 4477fcbb93
3 changed files with 33 additions and 38 deletions

View File

@ -27,6 +27,7 @@ develop-eggs
.venv
.*.swp
.coverage
bandit.xml
cover
AUTHORS
ChangeLog

View File

@ -1,21 +1,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# The right to copy, distribute, modify, or otherwise make use
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
# SPDX-License-Identifier: Apache-2.0
#
from coverage import Coverage

View File

@ -35,23 +35,25 @@ setenv = VIRTUAL_ENV={envdir}
SYSINV_TEST_ENV=True
TOX_WORK_DIR={toxworkdir}
PYLINTHOME={toxworkdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]cgcsdir}/tsconfig/tsconfig
-e{[tox]cgcsdir}/configutilities/configutilities
-e{[tox]cgcsdir}/middleware/fault/recipes-common/fm-api
-e{[tox]cgcsdir}/controllerconfig/controllerconfig
-e{[tox]cgcsdir}/middleware/patching/recipes-common/cgcs-patch/cgcs-patch
-e{[tox]cgcsdir}/middleware/util/recipes-common/platform-util/platform-util
-e{[tox]avsdir}/python-vswitchclient
commands =
pip install -e {toxinidir}/../../../../config/recipes-common/tsconfig/tsconfig
pip install -e {toxinidir}/../../../../config/recipes-control/configutilities/configutilities
pip install -e {toxinidir}/../../../../fault/recipes-common/fm-api
pip install -e {toxinidir}/../../../../config/recipes-control/controllerconfig/controllerconfig
pip install -e {toxinidir}/../../../../patching/recipes-common/cgcs-patch/cgcs-patch
pip install -e {toxinidir}/../../../../util/recipes-common/platform-util/platform-util
find . -type f -name "*.pyc" -delete
python tools/patch_tox_venv.py
py.test {posargs}
python setup.py testr --testr-args='{posargs}'
#py.test {posargs}
# TODO: remove ignore E722 when issue 8174 is resolved
# F series are flake8
# F series are flake8. All should be fixed
# F401 'sysinv.common.exception' imported but unused
# F403 'from netaddr import *' used; unable to detect undefined names
# F821 undefined name 'exc'
@ -94,29 +96,19 @@ commands = flake8 {posargs}
[testenv:py27]
basepython = python2.7
[testenv:pep8]
basepython = python2.7
deps = flake8
commands =
flake8 {posargs}
[testenv:venv]
commands = {posargs}
[testenv:bandit]
basepython = python2.7
deps = {[testenv]deps}
-e{[tox]cgcsdir}/tsconfig/tsconfig
-e{[tox]cgcsdir}/configutilities/configutilities
-e{[tox]cgcsdir}/middleware/fault/recipes-common/fm-api
-e{[tox]cgcsdir}/controllerconfig/controllerconfig
-e{[tox]cgcsdir}/middleware/patching/recipes-common/cgcs-patch/cgcs-patch
-e{[tox]cgcsdir}/middleware/util/recipes-common/platform-util/platform-util
-e{[tox]cgcsdir}/sysinv/cgts-client/cgts-client
-e{[tox]avsdir}/python-vswitchclient
bandit
[bandit]
# The following bandit tests are being skipped:
# B101: Test for use of assert
# B104: Test for binding to all interfaces
@ -132,8 +124,24 @@ deps = {[testenv]deps}
# B506: Test for use of yaml load
# B603: Test for use of subprocess with shell equals true
# B607: Test for starting a process with a partial path
skips = B101,B104,B107,B108,B110,B111,B310,B311,B404,B410,B504,B506,B603,B607
excludes = tests
commands = bandit -r sysinv -x tests --skip B101,B104,B107,B108,B110,B111,B310,B311,B404,B410,B504,B506,B603,B607
[testenv:bandit]
basepython = python2.7
deps = {[testenv]deps}
-e{[tox]cgcsdir}/tsconfig/tsconfig
-e{[tox]cgcsdir}/configutilities/configutilities
-e{[tox]cgcsdir}/middleware/fault/recipes-common/fm-api
-e{[tox]cgcsdir}/controllerconfig/controllerconfig
-e{[tox]cgcsdir}/middleware/patching/recipes-common/cgcs-patch/cgcs-patch
-e{[tox]cgcsdir}/middleware/util/recipes-common/platform-util/platform-util
-e{[tox]cgcsdir}/sysinv/cgts-client/cgts-client
-e{[tox]avsdir}/python-vswitchclient
bandit
commands = bandit --ini tox.ini -f xml -o bandit.xml -r sysinv -x tests --skip B101,B104,B107,B108,B110,B111,B310,B311,B404,B410,B504,B506,B603,B607
[testenv:pylint]
basepython = python2.7