
Enabling automatic tests with tox and zuul for each new patchset. To see the unit test logs, go to: 1- Zuul Summary 2- tox-unittests 3- Logs 4- job-output.txt Test Plan: PASS: Run "tox -e unittests" in the terminal, this will: - Set the PYTHONPATH environment variable - Run the tests - Show the coverage report Task: 47929 Story: 2005051 Change-Id: I7f527860f3498c53b28691c654035d017d70f68b Signed-off-by: Lindley Werner <lindley.vieira@encora.com>
54 lines
1.6 KiB
INI
54 lines
1.6 KiB
INI
[tox]
|
|
envlist = linters,pylint,unittests
|
|
minversion = 2.3
|
|
skipsdist = True
|
|
|
|
[testenv]
|
|
deps = -r{toxinidir}/requirements/test-requirements.txt
|
|
allowlist_externals = reno
|
|
|
|
[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' \
|
|
-not \( -type f -path *template* -prune \) \
|
|
-print0 | xargs -0 yamllint"
|
|
bash -c "find {toxinidir} \
|
|
-not \( -type d -name .?\* -prune \) \
|
|
-type f \
|
|
-not -name \*~ \
|
|
-not -name \*.md \
|
|
-name \*.sh \
|
|
-print0 | xargs -0 bashate -v -iE006,E040"
|
|
|
|
[testenv:pylint]
|
|
basepython = python3
|
|
sitepackages = False
|
|
setenv =
|
|
BASEPATH = {toxinidir}/virtualbox/pybox
|
|
PYTHONPATH= {env:BASEPATH}:{env:BASEPATH}/helper:{env:BASEPATH}/consts:{env:BASEPATH}/utils
|
|
deps =
|
|
-r{env:BASEPATH}/requirements.txt
|
|
{[testenv]deps}
|
|
allowlist_externals = pylint
|
|
commands = pylint {posargs} --rcfile=./pylint.rc virtualbox/pybox
|
|
|
|
[testenv:unittests]
|
|
basepython = python3
|
|
setenv =
|
|
BASEPATH = {toxinidir}/virtualbox/pybox
|
|
PYTHONPATH= {env:BASEPATH}:{env:BASEPATH}/helper:{env:BASEPATH}/consts:{env:BASEPATH}/utils
|
|
deps =
|
|
-r{toxinidir}/virtualbox/pybox/requirements.txt
|
|
coverage
|
|
change_dir = {env:BASEPATH}
|
|
commands =
|
|
coverage run -m unittest discover
|
|
coverage report -m
|