network/tox.ini
Rich Megginson 23937b6360 use python instead of envpython
Many of the tests and tasks invoked from `tox` would try to use
the path to the `python` executable in the tox virtualenv, and
in some cases, would try to follow the symlink if the `python`
command were a symlink, in some cases, following the symlink to
the system python, and trying to use the absolute path.  This
would fail in some cases because when using the system python
with the absolute path, the python modules installed in the
tox venv could not be found.  So instead, just use the `python`
command from the venv with no path.

also enable travis 3.8-dev testing, since this fix allows that
platform to work correctly.
2020-04-01 20:57:09 +02:00

272 lines
6.5 KiB
INI

# SPDX-License-Identifier: MIT
[tox]
envlist =
black, pylint, flake8, yamllint
py{26,27,36,37,38},
custom
skipsdist = true
skip_missing_interpreters = true
[testenv]
basepython = python3
# List common dependencies for Python interpreters here:
deps =
py{26,27,36,37,38}: pytest-cov
py{27,36,37,38}: pytest>=3.5.1
py{26,27}: mock
py26: pytest
[base]
system_python = /usr/bin/python3
passenv = *
setenv =
PYTHONPATH = {toxinidir}/library:{toxinidir}/module_utils
LC_ALL = C
changedir = {toxinidir}/tests
covtargets = --cov={toxinidir}/library --cov={toxinidir}/module_utils
pytesttarget = unit
whitelist_externals =
bash
runpytest = {toxinidir}/.travis/runpytest.sh
[testenv:py26]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.6}
install_command =
pip install {opts} {packages}
list_dependencies_command =
pip freeze
basepython = python2.6
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[base]runpytest} \
--durations=5 \
{[base]covtargets} \
--cov-report=html:htmlcov-py26 \
--cov-report=term \
{posargs} \
{[base]pytesttarget}
[testenv:py27]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7}
basepython = python2.7
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[base]runpytest} \
--durations=5 \
{[base]covtargets} \
--cov-report=html:htmlcov-py27 \
--cov-report=term \
{posargs} \
{[base]pytesttarget}
[testenv:py36]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.6}
basepython = python3.6
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[base]runpytest} \
--durations=5 \
{[base]covtargets} \
--cov-report=html:htmlcov-py36 \
--cov-report=term \
{posargs} \
{[base]pytesttarget}
[testenv:py37]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.7}
basepython = python3.7
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[base]runpytest} \
--durations=5 \
{[base]covtargets} \
--cov-report=html:htmlcov-py37 \
--cov-report=term \
{posargs} \
{[base]pytesttarget}
[testenv:py38]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.8}
basepython = python3.8
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[base]runpytest} \
--durations=5 \
{[base]covtargets} \
--cov-report=html:htmlcov-py38 \
--cov-report=term \
{posargs} \
{[base]pytesttarget}
[testenv:black]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.6}
basepython = python3.6
passenv = RUN_BLACK_*
deps =
black
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {toxinidir}/.travis/runblack.sh --check --diff .
[testenv:pylint]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7}
basepython = python2.7
passenv = RUN_PYLINT_*
setenv =
{[base]setenv}
deps =
colorama
pylint>=1.8.4
ansible
-rpylint_extra_requirements.txt
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {toxinidir}/.travis/runpylint.sh --errors-only {posargs}
[testenv:flake8]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7}
basepython = python2.7
passenv = RUN_FLAKE8_*
deps =
flake8>=3.5
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {toxinidir}/.travis/runflake8.sh --exclude=.venv,.tox --statistics {posargs} .
[testenv:yamllint]
deps = yamllint
commands = yamllint .
[testenv:coveralls]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:coveralls}
passenv = TRAVIS TRAVIS_*
whitelist_externals = bash
deps =
coveralls
changedir = {[base]changedir}
commands =
bash -c 'cd ..; bash .travis/fix-coverage.sh; cd -'
coveralls
[molecule_common]
deps =
{env:LSR_ANSIBLE_DEP:ansible}
docker
molecule<3
selinux
-rmolecule_extra_requirements.txt
runsyspycmd = {toxinidir}/.travis/runsyspycmd.sh
[testenv:molecule_version]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
deps =
{[molecule_common]deps}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[molecule_common]runsyspycmd} molecule --version
bash {[molecule_common]runsyspycmd} ansible --version
[testenv:molecule_lint]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
deps =
{[molecule_common]deps}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[molecule_common]runsyspycmd} \
molecule lint -s {env:LSR_MSCENARIO:default} {posargs}
[testenv:molecule_syntax]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
deps =
{[molecule_common]deps}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[molecule_common]runsyspycmd} \
molecule syntax -s {env:LSR_MSCENARIO:default} {posargs}
[testenv:molecule_test]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
deps =
{[molecule_common]deps}
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {[molecule_common]runsyspycmd} \
molecule test -s {env:LSR_MSCENARIO:default} {posargs}
[testenv:molecule]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
deps =
{[molecule_common]deps}
whitelist_externals =
{[base]whitelist_externals}
commands =
{[testenv:molecule_version]commands}
{[testenv:molecule_lint]commands}
{[testenv:molecule_syntax]commands}
{[testenv:molecule_test]commands}
[testenv:custom]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:custom}
deps =
-rcustom_requirements.txt
passenv = *
whitelist_externals =
{[base]whitelist_externals}
commands =
bash {toxinidir}/.travis/custom.sh
[pytest]
addopts = -rxs
[flake8]
show_source = true
max-line-length = 88
ignore = E402,W503
[pylint]
max-line-length = 88
disable = wrong-import-position
[pycodestyle]
max-line-length = 88
[travis]
python =
2.6: py26,custom
2.7: py27,flake8,pylint,custom
3.5: coveralls,custom
3.6: py36,black,yamllint,custom
3.7: py37,custom
3.8: py38,custom