summaryrefslogtreecommitdiffstats
path: root/tox.ini
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:58 +0000
commitba233a0cbad76b4783a03893e7bf4716fbc0f0ec (patch)
treead369728c1edbe3631c8150585659078ae5d7d0b /tox.ini
parentReleasing progress-linux version 6.17.2-3~progress7.99u1. (diff)
downloadansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.tar.xz
ansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.zip
Merging upstream version 24.6.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tox.ini')
-rw-r--r--tox.ini61
1 files changed, 41 insertions, 20 deletions
diff --git a/tox.ini b/tox.ini
index 173880c..bbc0dba 100644
--- a/tox.ini
+++ b/tox.ini
@@ -9,6 +9,8 @@ envlist =
schemas
py
py-devel
+ lower
+ pre
eco
isolated_build = true
skip_missing_interpreters = True
@@ -18,19 +20,23 @@ requires =
[testenv]
description =
- Run the tests under {basepython} and
- devel: ansible devel branch
+ Run the tests under {basepython}
+ devel: and ansible devel branch
+ pre: and enable --pre when installing dependencies, testing prereleases
deps =
devel: ansible-core @ git+https://github.com/ansible/ansible.git # GPLv3+
devel: ansible-compat @ git+https://github.com/ansible/ansible-compat.git # GPLv3+
extras =
test
commands_pre =
- sh -c "rm -f .tox/.coverage.* 2>/dev/null || true"
- bash ./tools/install-reqs.sh
-commands =
+ sh -c "rm -f {envdir}/.coverage.* 2>/dev/null || true"
# safety measure to assure we do not accidentally run tests with broken dependencies
{envpython} -m pip check
+ {envpython} -m pip freeze
+ bash ./tools/install-reqs.sh
+ ansible --version
+commands =
+ sh -c "{envpython} -m pip freeze > {envdir}/log/requirements.txt"
coverage run -m pytest {posargs:\
-n auto \
-ra \
@@ -38,7 +44,7 @@ commands =
--doctest-modules \
--durations=10 \
}
- sh -c "coverage combine -a -q --data-file=.coverage .tox/.coverage.*"
+ {py,py310,py311,py312,py313}: sh -c "coverage combine -a -q --data-file={envdir}/.coverage {toxworkdir}/*/.coverage.* && coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml --fail-under=0"
passenv =
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
@@ -60,13 +66,14 @@ passenv =
setenv =
# Avoid runtime warning that might affect our devel testing
devel: ANSIBLE_DEVEL_WARNING = false
- COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
+ COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
- PIP_CONSTRAINT = {toxinidir}/.config/requirements.txt
- devel,pkg: PIP_CONSTRAINT = /dev/null
+ PIP_CONSTRAINT = {toxinidir}/.config/constraints.txt
+ devel,pkg,pre,py310: PIP_CONSTRAINT = /dev/null
PIP_DISABLE_PIP_VERSION_CHECK = 1
PRE_COMMIT_COLOR = always
FORCE_COLOR = 1
+ pre: PIP_PRE = 1
allowlist_externals =
bash
find
@@ -76,6 +83,7 @@ allowlist_externals =
sh
tox
./tools/test-hook.sh
+ {toxworkdir}/.pipx/bin/ansible-lint
# https://tox.wiki/en/latest/upgrading.html#editable-mode
package = editable
@@ -83,14 +91,13 @@ package = editable
description = Run all linters
# pip compile includes python version in output constraints, so we want to
# be sure that version does not change randomly.
-basepython = python3.9
+basepython = python3.10
deps =
pre-commit>=2.6.0
setuptools>=51.1.1
pytest>=7.2.2 # to updated schemas
skip_install = true
commands_pre =
- {[testenv]commands_pre}
commands =
{envpython} -m pre_commit run --all-files --show-diff-on-failure {posargs:}
passenv =
@@ -101,6 +108,11 @@ setenv =
# avoid messing pre-commit with out own constraints
PIP_CONSTRAINT=
+[testenv:lower]
+description = Install using lower-constraints.txt file for testing oldest versions.
+setenv =
+ PIP_CONSTRAINT = {toxinidir}/.github/lower-constraints.txt
+
[testenv:hook]
description = Validate pre-commit hook definition
deps = pre-commit
@@ -114,12 +126,13 @@ description = Bump all test dependencies
# we reuse the lint environment
envdir = {toxworkdir}/lint
skip_install = true
-basepython = python3.9
+basepython = python3.10
deps =
{[testenv:lint]deps}
setenv =
# without his upgrade would likely not do anything
PIP_CONSTRAINT = /dev/null
+commands_pre =
commands =
-pre-commit run --all-files --show-diff-on-failure --hook-stage manual lock
-pre-commit run --all-files --show-diff-on-failure --hook-stage manual up
@@ -141,8 +154,10 @@ setenv =
TERM = dump
skip_install = false
usedevelop = true
+commands_pre =
+ ansible-lint --version
commands =
- mkdocs build {posargs:}
+ mkdocs {posargs:build --strict --site-dir=_readthedocs/html/}
[testenv:redirects]
description = Update documentation redirections for readthedocs
@@ -155,9 +170,9 @@ commands =
[testenv:schemas]
description = Rebuild and test JSON Schemas
deps =
- check-jsonschema
+ check-jsonschema>=0.26.3
setenv =
- # without his upgrade would likely not do anything
+ # without this upgrade would likely not do anything
PIP_CONSTRAINT = /dev/null
skip_install = true
changedir = test/schemas
@@ -187,11 +202,15 @@ description =
deps =
build >= 0.9.0
twine >= 4.0.1
+ pipx
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands_pre =
- {[testenv]commands_pre}
commands =
+ # Testing pipx usage
+ bash -c "PIPX_BIN_DIR={toxworkdir}/.pipx/bin PIPX_HOME={toxworkdir}/.pipx pipx install --force -e ."
+ # Testing that calling the pipx installation does return 0 return code and no output in stderr
+ bash -c "if stderr=$({toxworkdir}/.pipx/bin/ansible-lint --version >/dev/null) && test -z \"$stderr\"; then echo "ok"; fi"
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
@@ -200,9 +219,9 @@ commands =
shutil.rmtree(dist_dir)'
{envpython} -m build --outdir {toxinidir}/dist/ {toxinidir}
# Validate metadata using twine
- twine check --strict {toxinidir}/dist/*
+ python3 -m twine check --strict {toxinidir}/dist/*
# Install the wheel
- sh -c 'python3 -m pip install "ansible-lint[lock] @ file://$(echo {toxinidir}/dist/*.whl)"'
+ sh -c 'python3 -m pip install "ansible-lint @ file://$(echo {toxinidir}/dist/*.whl)"'
# Uninstall it
python3 -m pip uninstall -y ansible-lint
@@ -210,9 +229,11 @@ commands =
description = Remove temporary files
skip_install = true
deps =
+commands_pre =
+commands_post =
commands =
- find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -name coverage.xml -name .coverage
- rm -rf .mypy_cache
+ find . -type d \( -name __pycache__ -o -name .mypy_cache \) -delete
+ find . -type f \( -name '*.py[co]' -o -name ".coverage*" -o -name coverage.xml \) -delete
[testenv:coverage]
description = Combines and displays coverage results