kayobe/tox.ini
Pierre Riteau c585554988 CI: Fix kayobe-tox-molecule job
When molecule runs, it installs ansible>2.8, which is version 2.10.0
since today. This now also installs the ansible-base package, currently
at version 2.10.1. Then it installs the version of ansible required by
kayobe, i.e. ansible>=2.8.0,<2.10.0 (currently 2.9.13).

We end up with a tox molecule venv containing:

ansible==2.9.13
ansible-base==2.10.1

This causes the following issue:

ERROR! Unexpected Exception, this is probably a bug: cannot import name 'AnsibleCollectionLoader' from 'ansible.utils.collection_loader' (/home/zuul/src/opendev.org/openstack/kayobe/.tox/molecule/lib/python3.8/site-packages/ansible/utils/collection_loader/__init__.py)

This commit adds requirements.txt to the molecule tox deps, which
ensures the correct version of ansible gets installed first.

Change-Id: I7ef890a2ae6fd67f53e1b8bca244a1c0d44fea53
2020-09-23 18:34:23 +02:00

144 lines
4.2 KiB
INI

[tox]
minversion = 3.1
envlist = py3,pep8
skipsdist = True
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
passenv =
HOME
whitelist_externals =
bash
rm
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
[testenv:pep8]
# sphinx8 needs the sphinx package which is required via doc/requirements.txt
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
{toxinidir}/tools/run-bashate.sh
flake8 {posargs} kayobe
# Check the *.rst files
# We use a thin wrapper around doc8 currently, which has support for sphinx
# directives.
{toxinidir}/tools/sphinx8 README.rst CONTRIBUTING.rst doc/source --ignore D001
yamllint etc/kayobe
[testenv:venv]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = {posargs}
[testenv:ansible]
# Create the virtualenv with access to system site packages, as this is
# required to use the python and apt modules, which are not available via PyPI.
sitepackages = True
commands =
# Install ansible role dependencies from Galaxy.
{toxinidir}/tools/ansible-galaxy-retried.sh install \
-r {toxinidir}/requirements.yml \
-p {toxinidir}/ansible/roles
{toxinidir}/tools/test-ansible.sh {posargs}
[testenv:molecule]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
whitelist_externals =
bash
commands =
# Install ansible role dependencies from Galaxy.
{toxinidir}/tools/ansible-galaxy-retried.sh install \
-r {toxinidir}/requirements.yml \
-p {toxinidir}/ansible/roles
bash -c "source {envdir}/bin/activate && {toxinidir}/tools/test-molecule.sh {posargs}"
[testenv:alint]
commands = ansible-lint ansible/*.yaml
[testenv:ansible-syntax]
commands =
# Install ansible role dependencies from Galaxy.
{toxinidir}/tools/ansible-galaxy-retried.sh install \
-r {toxinidir}/requirements.yml \
-p {toxinidir}/ansible/roles
# Perform an Ansible syntax check. Skip some playbooks which require extra
# variables to be defined.
bash -c \
"ansible-playbook \
--connection=local \
--syntax-check \
--list-tasks \
$(find {toxinidir}/ansible \
-maxdepth 1 \
-name '*.yml' \
-not -name idrac-bootstrap-one.yml \
-not -name idrac-bootstrap.yml) \
{posargs}"
[testenv:cover]
setenv =
VIRTUAL_ENV={envdir}
PYTHON=coverage run --source kayobe --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage report
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:docs]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build/html
sphinx-build -W --keep-going -b html doc/source doc/build/html
whereto doc/source/_extra/.htaccess doc/test/redirect-tests.txt
[testenv:pdf-docs]
whitelist_externals = make
deps = {[testenv:docs]deps}
commands =
rm -rf doc/build/pdf
sphinx-build -W --keep-going -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:releasenotes]
deps = {[testenv:docs]deps}
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build