molteniron/tox.ini
Riccardo Pittau 5cf167d567 Update molteniron tests and requirements
Make things as pretty as possible while moving to current openstack
Y cycle tests.

Change-Id: I22777cf34888171daf69c44705d8ecc7339f8278
2021-10-06 18:12:20 +02:00

170 lines
5.9 KiB
INI

[tox]
minversion = 3.18.0
skipsdist = True
envlist = py3,pep8
ignore_basepython_conflict=true
[testenv]
basepython = python3
usedevelop = True
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
allowlist_externals = mkdir
diff
commands = mkdir -p testenv/var/run/
mkdir -p testenv/tmp/
python setup.py \
install \
--install-data=testenv/ \
--install-scripts=testenv/bin/ \
--install-purelib=testenv/lib/python2.7/site-packages/
moltenirond-helper \
--pid-dir=testenv/var/run/ \
start
molteniron \
delete_db
molteniron \
add_baremetal test1 10.1.2.1 user password 10.1.2.3,10.1.2.4 de:ad:be:ef:00:01 ppc64el 8 2048 32
molteniron \
add_keyvalue_pairs test2 \
10.1.2.2 \
10.1.2.5,10.1.2.6 \
'ipmi_user="user"' \
'ipmi_password="password"' \
'port_hwaddr="de:ad:be:ef:00:01"' \
'cpu_arch=ppc64el' \
'cpus=8' \
'ram_mb=2048' \
'disk_gb=32'
# @BUG - tox is broken
# passing in '{"ipmi_user": "user"}' results in:
# tox.ConfigError: ConfigError: No support for the "ipmi_user" substitution type
# and escaping the curly braces '\{"ipmi_user": "user"\}'
# mentioned in http://tox.readthedocs.io/en/latest/config.html#substitutions
# passes in '\\{"ipmi_user": "user"\\}' which breaks json.loads()
# ValueError: No JSON object could be decoded
# molteniron \
# add_json_blob test3 \
# 10.1.2.3 \
# 10.1.2.7,10.1.2.8 \
# '{"ipmi_user": "user", "ipmi_password": "password", "port_hwaddr": "de:ad:be:ef:00:01", "cpu_arch": "ppc64el", "cpus": 8, "ram_mb": 2048, "disk_gb": 32''}'
molteniron \
allocate hamzy 1
molteniron \
get_field hamzy port_hwaddr
molteniron \
release hamzy
# Sadly needs a bash shell to run uuidgen
test_hook_mi_ipmiblob.sh
diff testenv/tmp/hardware_info molteniron/tests/hardware_info.good
diff testenv/tmp/localrc molteniron/tests/localrc.good
python \
molteniron/tests/testAllocateBM.py
python \
molteniron/tests/testAddBMNode.py
python \
molteniron/tests/testCull.py
python \
molteniron/tests/testDeallocateBM.py
python \
molteniron/tests/testDeallocateOwner.py
python \
molteniron/tests/testDoClean.py
python \
molteniron/tests/testGetField.py
python \
molteniron/tests/testGetIps.py
python \
molteniron/tests/testRemoveBMNode.py
moltenirond-helper \
--pid-dir=testenv/var/run/ \
stop
[testenv:pep8]
deps=
hacking>=4.1.0,<5.0.0 # Apache-2.0
flake8-import-order>=0.17.1 # LGPLv3
pycodestyle>=2.0.0,<3.0.0 # MIT
commands = flake8 {posargs}
[testenv:venv]
setenv = PYTHONHASHSEED=0
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = {posargs}
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --parallel-mode
# After running this target, visit molteniron/cover/index.html
# in your browser, to see a nicer presentation report with annotated
# HTML listings detailing missed lines.
commands = coverage erase
stestr run {posargs}
coverage combine
coverage report
coverage html
coverage xml -o cover/coverage.xml
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -b html -W doc/source doc/build/html
[testenv:pdf-docs]
allowlist_externals = make
deps = {[testenv:docs]deps}
commands =
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:releasenotes]
usedevelop = False
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:debug]
commands = oslo_debug_helper {posargs}
[flake8]
show-source = True
# E123, E125 skipped as they are invalid PEP-8.
# E741 ambiguous variable name.
# W503 Line break occurred before a binary operator. Conflicts with W504.
ignore = E123,E125,E741,W503
# [H106] Don't put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.
# [H204] Use assert(Not)Equal to check for equality.
# [H205] Use assert(Greater|Less)(Equal) for comparison.
# [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls
# [H904] Delay string interpolations at logging calls.
enable-extensions=H106,H203,H204,H205,H210,H904
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,testenv
import-order-style = pep8
application-import-names = molteniron
filename =
*.py,
*molteniron,
*moltenirond-helper
[testenv:lower-constraints]
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt