
Until now no unit tests have been executed in py37 environment. This change fixes tox configuration to enable running these tests. It also fixes two unit tests to handle PEP479 being enabled for all code in Python 3.7 [1, 2]. [1] https://docs.python.org/3/whatsnew/3.7.html#changes-in-python-behavior [2] https://stackoverflow.com/questions/51700960/runtimeerror-generator-raised-stopiteration-every-time-i-try-to-run-app Change-Id: I7fcf30d848efb8dc4cc6ca19056868aa6127cf60
99 lines
2.5 KiB
INI
99 lines
2.5 KiB
INI
[tox]
|
|
envlist = py37,pep8,cover
|
|
minversion = 2.5
|
|
skipsdist = True
|
|
|
|
[testenv]
|
|
basepython = python3
|
|
usedevelop = True
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
OS_TEST_PATH=monasca_common/tests
|
|
passenv = http_proxy
|
|
HTTP_PROXY
|
|
https_proxy
|
|
HTTPS_PROXY
|
|
no_proxy
|
|
NO_PROXY
|
|
whitelist_externals = bash
|
|
find
|
|
rm
|
|
install_command = pip install {opts} {packages}
|
|
deps =
|
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
|
|
-r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
commands =
|
|
find {toxinidir} -type f -name '*.pyc' -delete
|
|
|
|
[testenv:py36]
|
|
basepython = python3.6
|
|
setenv =
|
|
{[testenv]setenv}
|
|
BLACKLIST_FILE={toxinidir}/test-blacklist-py3.txt
|
|
commands =
|
|
{[testenv]commands}
|
|
stestr run --blacklist-file {env:BLACKLIST_FILE} {posargs}
|
|
|
|
[testenv:py37]
|
|
basepython = python3.7
|
|
setenv =
|
|
{[testenv]setenv}
|
|
BLACKLIST_FILE={toxinidir}/test-blacklist-py3.txt
|
|
commands =
|
|
{[testenv]commands}
|
|
stestr run --blacklist-file {env:BLACKLIST_FILE} {posargs}
|
|
|
|
[testenv:cover]
|
|
setenv =
|
|
PYTHON=coverage run --source monasca_common --parallel-mode
|
|
commands =
|
|
coverage erase
|
|
stestr run {posargs}
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
|
|
[testenv:debug]
|
|
commands =
|
|
{[testenv]commands}
|
|
oslo_debug_helper -t {env:OS_TEST_PATH} {posargs}
|
|
|
|
[testenv:bandit]
|
|
# B101(assert_ussed) - Validation uses asserts because of performance reasons
|
|
# monasca_common/kafka_lib is a clone of kafka-python and will be deleted in the future
|
|
commands = bandit -r monasca_common -n5 -s B101 -x monasca_common/tests -x monasca_common/kafka_lib
|
|
|
|
[testenv:flake8]
|
|
commands = flake8 monasca_common
|
|
|
|
[testenv:pep8]
|
|
commands =
|
|
{[testenv:flake8]commands}
|
|
{[testenv:bandit]commands}
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[testenv:bindep]
|
|
deps = bindep
|
|
commands = bindep test
|
|
|
|
[flake8]
|
|
max-complexity = 50
|
|
max-line-length = 100
|
|
builtins = _
|
|
exclude=.venv,.git,.tox,dist,*egg,build
|
|
show-source = True
|
|
# note: Due to the need to fork kafka-python, many pep8 violations occure.
|
|
# All of the below ignores are caused by the forked kafka-python library
|
|
# so when Monasca migrates to confluent-kafka, the below line can be removed.
|
|
ignore = H101,H301,H404,H405
|
|
|
|
[testenv:lower-constraints]
|
|
setenv = {[testenv:py36]setenv}
|
|
deps =
|
|
-c{toxinidir}/lower-constraints.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-r{toxinidir}/requirements.txt
|
|
commands = {[testenv:py36]commands}
|