summaryrefslogtreecommitdiffstats
path: root/ansible_collections/amazon/aws/tox.ini
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
commit38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch)
tree356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/amazon/aws/tox.ini
parentAdding upstream version 7.7.0+dfsg. (diff)
downloadansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz
ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/amazon/aws/tox.ini')
-rw-r--r--ansible_collections/amazon/aws/tox.ini89
1 files changed, 83 insertions, 6 deletions
diff --git a/ansible_collections/amazon/aws/tox.ini b/ansible_collections/amazon/aws/tox.ini
index 292a97001..179ed761c 100644
--- a/ansible_collections/amazon/aws/tox.ini
+++ b/ansible_collections/amazon/aws/tox.ini
@@ -1,18 +1,27 @@
[tox]
-skipsdist=True
-envlist = clean,ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints}
+skipsdist = True
+envlist = clean,ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints},linters
+# Tox4 supports labels which allow us to group the environments rather than dumping all commands into a single environment
+labels =
+ format = flynt, black, isort
+ lint = complexity-report, ansible-lint, black-lint, isort-lint, flake8-lint, flynt-lint
+ units = ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints}
+
+[common]
+format_dirs = {toxinidir}/plugins {toxinidir}/tests
[testenv]
+description = Run the test-suite and generate a HTML coverage report
deps =
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-units
+ 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 plugins {posargs:tests/}
+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/}
[testenv:clean]
deps = coverage
@@ -20,8 +29,76 @@ 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>=3.3.0,<5.0.0
flake8-html
-commands = -flake8 --select C90 --max-complexity 10 --format=html --htmldir={posargs} plugins
+commands = -flake8 --select C90 --max-complexity 10 --format=html --htmldir={posargs:complexity} plugins
+
+[testenv:ansible-lint]
+deps =
+ ansible-lint
+commands =
+ ansible-lint {toxinidir}/plugins
+
+[testenv:black]
+depends =
+ flynt, isort
+deps =
+ black >=23.0, <24.0
+commands =
+ black {[common]format_dirs}
+
+[testenv:black-lint]
+deps =
+ {[testenv:black]deps}
+commands =
+ black -v --check --diff {[common]format_dirs}
+
+[testenv:isort]
+deps =
+ isort
+commands =
+ isort {[common]format_dirs}
+
+[testenv:isort-lint]
+deps =
+ {[testenv:isort]deps}
+commands =
+ isort --check-only --diff {[common]format_dirs}
+
+[testenv:flake8-lint]
+deps =
+ flake8
+commands =
+ flake8 {posargs} {[common]format_dirs}
+
+[testenv:flynt]
+deps =
+ flynt
+commands =
+ flynt {[common]format_dirs}
+
+[testenv:flynt-lint]
+deps =
+ flynt
+commands =
+ flynt --dry-run {[common]format_dirs}
+
+[testenv:linters]
+deps =
+ {[testenv:black]deps}
+ {[testenv:isort]deps}
+ flake8
+commands =
+ black -v --check {toxinidir}/plugins {toxinidir}/tests
+ isort --check-only --diff {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 = _