From 87bf6951fbfd1db66a8308895c076e347cff6fa0 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 13 Jun 2023 10:13:15 +0200 Subject: [PATCH] Update tox.ini Signed-off-by: Alina Buzachis --- tox.ini | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/tox.ini b/tox.ini index 88e4fa58a84..9b187eba7e0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,28 +1,52 @@ [tox] -minversion = 1.4.2 -skipsdist = True +skipsdist=True +envlist = clean,ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints},linters -[testenv:black_check] +[testenv] +description = Run the test-suite and generate a HTML coverage report deps = - black >=23.0, <24.0 + pytest + pytest-cov + ansible2.12: ansible-core>2.12,<2.13 + ansible2.13: ansible-core>2.13,<2.14 + !ansible2.12-!ansible2.13: ansible-core + pytest-ansible + -rtest-requirements.txt + with_constraints: -rtests/unit/constraints.txt +commands = pytest --cov-report html --cov plugins/callback --cov plugins/inventory --cov plugins/lookup --cov plugins/module_utils --cov plugins/modules --cov plugins/plugin_utils plugins {posargs:tests/} -commands = - black -v --check --diff {toxinidir}/plugins {toxinidir}/tests +[testenv:clean] +deps = coverage +skip_install = true +commands = coverage erase + +[testenv:complexity-report] +description = Generate a HTML complexity report in the complexity directory +deps = + # See: https://github.com/lordmauve/flake8-html/issues/30 + flake8>=3.3.0,<5.0.0 + flake8-html +commands = -flake8 --select C90 --max-complexity 10 --format=html --htmldir={posargs:complexity} plugins [testenv:black] deps = - {[testenv:black_check]deps} + black >=23.0, <24.0 commands = - black -v {posargs:{toxinidir}/plugins {toxinidir}/tests} + black {toxinidir}/plugins {toxinidir}/tests [testenv:linters] deps = - yamllint + {[testenv:black]deps} flake8 - {[testenv:black_check]deps} commands = - {[testenv:black_check]commands} - yamllint -s {toxinidir} - flake8 {toxinidir} + black -v --check {toxinidir}/plugins {toxinidir}/tests + flake8 {posargs} {toxinidir}/plugins {toxinidir}/tests + +[flake8] +# E123, E125 skipped as they are invalid PEP-8. +show-source = True +ignore = E123,E125,E203,E402,E501,E741,F401,F811,F841,W503 +max-line-length = 160 +builtins = _