monasca-agent/tox.ini
Tomasz Trębski b71fd4bef4 Integrate with keystoneauth
Following commit makes enhancements to the
keystone handling inside monasca-agent:

* using generic password approach that abstracts from underlying
keystone version thus allows agent to be used seamlessly with
either v2.0 or v3. The only relevant part is the set of parameters
that one needs to supply to either monasca-reconfigure or agent.yaml
configuration file
* using keystone discovery - it simply means that agent will no longer
enforce particular keystone version but will allow keystoneauth
to pick the best match for given environment

Extra:
* extracted methods get_session and get_client utilize an aproach
presented above and can be used outside of monasca_agent.common.keystone
inside checks or detection plugins
* make imports to import only modules instead specific objects
* removed some redundant methods

Story: 2000995
Task: 4191

Needed-By: I579f6bcd5975a32af2a255be41c9b6c4043fa1dc
Needed-By: Ifee5b88ccb632222310aafb1081ecb9c9d085150
Change-Id: Iec97e50089ed31ae7ad8244b37cec128817871a5
2017-07-11 09:02:34 +02:00

97 lines
3.0 KiB
INI

[tox]
envlist = py27,pep8,cover
minversion = 2.5
skipsdist = True
[testenv]
usedevelop = True
setenv =
VIRTUAL_ENV={envdir}
DISCOVER_DIRECTORY=tests
CLIENT_NAME=monasca-agent
passenv = *_proxy
*_PROXY
deps = -r{toxinidir}/test-requirements.txt
whitelist_externals = bash
find
rm
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
commands =
find . -type f -name "*.pyc" -delete
rm -Rf .testrepository/times.dbm
[testenv:py27]
basepython = python2.7
commands =
{[testenv]commands}
ostestr {posargs}
[testenv:cover]
basepython = python2.7
commands =
{[testenv]commands}
coverage erase
python setup.py test --coverage --testr-args='{posargs}' --coverage-package-name=monasca_agent,monasca_setup
coverage report
[testenv:bandit]
commands =
# B101 - asserts used on purpose
# Following rules should be fixed in future
# B602[ subprocess_popen_with_shell_equals_true ] - removed when fixed
# B603[ subprocess_without_shell_equals_true ] - removed when fixed
# B301[ pickle ] - removed when fixed
# B303[ insecure MD5 usage ] - removed when fixed
# B311[ random ] - removed when fixed
# B403[ import_pickle ] - removed when fixed
# B404[ import_subprocess ] - removed when fixed
# B405[ import_xml_etree] - removed when fixed
# B310[ urllib_urlopen ] - removed when fixed
# B320[ xml_bad_tree ] - removed when fixed
# B410[ import_lxml ] - removed when fixed
# B411[ import_xmlrpclib ] - removed when fixed
# B605[ start_process_with_a_shell ] - removed when fixed
# B607[ start_process_with_partial_path ] - removed when fixed
# B608[ hardcoded_sql_expressions ] - removed when fixed
# B501[ request_with_no_cert_validation ] - removed when fixed
# B504[ ssl_with_no_version ] - removed when fixed
bandit -r monasca_agent -n5 -s B101,B602,B603,B301,B303,B311,B403,B404,B405,B310,B320,B410,B411,B501,B504,B605,B607,B608 -x {toxinidir}/tests
[testenv:flake8]
commands =
flake8 monasca_agent
flake8 monasca_setup
flake8 tests
[testenv:pep8]
deps =
{[testenv]deps}
commands =
{[testenv:flake8]commands}
{[testenv:bandit]commands}
[testenv:venv]
commands = {posargs}
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[flake8]
max-line-length = 120
max-complexity = 30
# TODO: ignored checks should be enabled in the future
# E501 Line length > 80 characters
# F401 module imported but unused
# H405 multi line docstring summary not separated with an empty line
ignore = E501,F401,H405
show-source = True
exclude=.venv,.git,.tox,dist,*egg,build,tests,tests_to_fix
[hacking]
local-check-factory = monasca_agent.hacking.checks.factory