[tox] minversion = 3.16.1 envlist = lint,py{38,37,36}-ansible{29,28,210,devel} isolated_build = true requires = setuptools >= 41.4.0 pip >= 19.3.0 skip_missing_interpreters = True # `usedevelop = true` overrides `skip_install` instruction, it's unwanted usedevelop = false [testenv] description = Run the tests with pytest under {basepython} deps = ansible28: ansible>=2.8,<2.9 ansible29: ansible>=2.9,<2.10 ansible210: ansible>=2.10.0a1,<2.11 # Be sure we do not install old ansible from default deps # https://github.com/ansible/ansible/issues/70705 ansibledevel: ansible>=2.10.0a1,<2.11 ansibledevel: ansible-base @ git+https://github.com/ansible/ansible.git -r test-requirements.in -c test-requirements.txt commands = # safety measure to assure we do not accidentaly run tests with broken dependencies python -m pip check {envpython} -m pytest \ --cov "{envsitepackagesdir}/ansiblelint" \ --junitxml "{toxworkdir}/junit.{envname}.xml" \ {posargs:} install_command = {envpython} -m \ pip install \ {opts} \ {packages} passenv = CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437 HOME REQUESTS_CA_BUNDLE # https proxies SSL_CERT_FILE # https proxies # recreate = True setenv = ANSIBLE_COLLECTIONS_PATHS = {envtmpdir} COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}} PIP_DISABLE_PIP_VERSION_CHECK = 1 whitelist_externals = ansibledevel: sh [testenv:.dev-env] #basepython = python3 basepython = /home/wk/.pyenv/versions/ansible-lint-py3.8.0-pyenv-venv/bin/python3 #{[testenv]deps} deps = # virtualenv >= 16 # setuptools >= 45.0.0 isolated_build = false skip_install = true recreate = false usedevelop = false [testenv:build-dists] basepython = python3 description = Build dists with PEP 517 and save them in the dist/ dir skip_install = true deps = pep517 >= 0.7.0 commands = {envpython} -c 'import os.path, shutil, sys; \ dist_dir = os.path.join("{toxinidir}", "dist"); \ os.path.isdir(dist_dir) or sys.exit(0); \ print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \ shutil.rmtree(dist_dir)' {envpython} -m pep517.build \ --source \ --binary \ --out-dir {toxinidir}/dist/ \ {toxinidir} # deprecated: use more generic 'lint' instead [testenv:flake8] deps = {[testenv:lint]deps} envdir = {toxworkdir}/lint skip_install = true commands = python -m pre_commit run --all-files flake8 [testenv:lint] basepython = python3 deps = pre-commit>=2.6.0 skip_install = true commands = python -m pre_commit run {posargs:--all-files --hook-stage manual -v} passenv = {[testenv]passenv} PRE_COMMIT_HOME [testenv:docs] basepython = python3 deps = -r{toxinidir}/docs/requirements.in -c{toxinidir}/docs/requirements.txt commands = # Build the html docs with Sphinx: {envpython} -m sphinx \ -j auto \ -b html \ --color \ -a \ -n \ -W \ -d "{temp_dir}/.doctrees" \ . \ "{envdir}/html" # Print out the output docs dir and a way to serve html: -{envpython} -c \ 'import pathlib; docs_dir = pathlib.Path(r"{envdir}") / "html"; index_file = docs_dir / "index.html"; '\ 'print("\n" + "=" * 120 + f"\n\nDocumentation available under `file://\{index_file\}`\n\nTo serve docs, use `python3 -m http.server --directory \{docs_dir\} 0`\n\n" + "=" * 120)' changedir = {toxinidir}/docs [testenv:metadata-validation] basepython = python3 description = Verify that dists under the dist/ dir have valid metadata depends = build-dists deps = twine skip_install = true # Ref: https://twitter.com/di_codes/status/1044358639081975813 commands = twine check {toxinidir}/dist/*