Run molecule with tox

This commit is contained in:
Till Maas 2019-04-25 15:33:34 +02:00
parent de194e7833
commit 48d17d44b3
2 changed files with 31 additions and 8 deletions

32
tox.ini
View file

@ -4,12 +4,16 @@ skipsdist = true
skip_missing_interpreters = True
[testenv]
basepython = python2.7
basepython = python3
deps =
py{26,27,36,37,38}: pytest-cov
py{27,36,37,38}: pytest>=3.5.1
py{26,27}: mock
py26: pytest
molecule_{lint,syntax,test}: docker
molecule_{lint,syntax,test}: jmespath
molecule_{lint,syntax,test}: molecule
molecule_{lint,syntax,test}: selinux
[base]
passenv = *
@ -21,17 +25,16 @@ covtarget = {toxinidir}/library --cov {toxinidir}/module_utils
pytesttarget = .
[testenv:black]
basepython = python3.6
deps = black
commands = black --check --diff --include "^[^.].*\.py$" .
[testenv:py26]
basepython = python2.6
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
basepython = python2.6
commands =
pytest \
--durations=5 \
@ -41,11 +44,11 @@ commands =
{[base]pytesttarget}
[testenv:py27]
basepython = python2.7
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
basepython = python2.7
commands =
pytest \
--durations=5 \
@ -55,11 +58,11 @@ commands =
{[base]pytesttarget}
[testenv:py36]
basepython = python3.6
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
basepython = python3.6
commands =
pytest \
--durations=5 \
@ -69,11 +72,11 @@ commands =
{[base]pytesttarget}
[testenv:py37]
basepython = python3.7
passenv = {[base]passenv}
setenv =
{[base]setenv}
changedir = {[base]changedir}
basepython = python3.7
commands =
pytest \
--durations=5 \
@ -112,6 +115,7 @@ commands =
tests/test_network_connections.py
[testenv:flake8]
basepython = python2.7
deps =
flake8>=3.5
whitelist_externals = flake8
@ -120,6 +124,7 @@ commands=
.
[testenv:coveralls]
basepython = python2.7
passenv = TRAVIS TRAVIS_*
deps =
coveralls
@ -128,12 +133,23 @@ commands =
coveralls
[testenv:ensure_non_running_provider]
basepython = python3.6
deps =
PyYAML
changedir = {toxinidir}/tests
commands = {toxinidir}/tests/ensure_non_running_provider.py
[testenv:molecule_lint]
commands_pre =
molecule --version
ansible --version
commands = molecule {posargs} lint
[testenv:molecule_syntax]
commands = molecule {posargs} syntax
[testenv:molecule_test]
commands = molecule {posargs} test
[pytest]
addopts = -rxs
@ -153,6 +169,6 @@ max-line-length = 88
python =
2.6: py26
2.7: py27,coveralls,flake8,pylint
3.6: py36,black,ensure_non_running_provider
3.6: py36,black,ensure_non_running_provider,molecule_lint,molecule_syntax,molecule_test
3.7: py37
3.8: py38