[tox] minversion = 3.18.0 skipsdist = True envlist = py,pep8,packaging,sanity requires = tox-ansible>=1.5.3 [testenv] usedevelop = True setenv = ANSIBLE_FORCE_COLOR={tty:1:0} VIRTUAL_ENV={envdir} passenv = HOME deps = -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt commands = stestr run --slowest {posargs} [testenv:venv] commands = {posargs} [testenv:pep8] deps = flake8 commands = flake8 [testenv:cover] setenv = PYTHON=coverage run --source repo_setup --parallel-mode commands = stestr run {posargs} coverage combine coverage html -d cover coverage xml -o cover/coverage.xml [testenv:packaging] description = Build package, verify metadata, install package and assert basic behavior deps = build twine ansible-core # used for ansible-galaxy command skip_install = true commands = # build wheel and sdist using PEP-517 {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 build \ --sdist \ --wheel \ --outdir {toxinidir}/dist/ \ {toxinidir} # Validate metadata using twine twine check {toxinidir}/dist/* # Install the wheel sh -c "python3 -m pip install {toxinidir}/dist/*.whl" # Assure that CLIs were installed repo-setup --help repo-setup-get-hash --help repo-setup-yum-config --help # Validate collection installation ansible-galaxy collection install --force . # Ensure that ansible is able to load the modules, as syntax check will fail # if modules cannot be loaded. sh -c "ansible-playbook --syntax-check playbooks/*.yaml" ansible localhost -m repo_setup.repos.get_hash -a "release=master os_version=centos9" allowlist_externals = sh # https://github.com/ansible-community/tox-ansible/issues/96 # Override ansible version coming from ansible-test package. [testenv:sanity] deps = ansible-core>=2.11,<2.12 [testenv:molecule] description = Used by all molecule jobs (tox-ansible) deps = ansible-core molecule>=3.3.0,<3.4.0 # bug with collection install molecule-docker usedevelop = False skip_install = true commands = ansible-galaxy collection install -v 'community.docker:>=1.8.0' ansible-galaxy collection install -v --force . molecule test [flake8] ignore = E501,W503,H803 show-source = True exclude = .tox,dist,doc,*.egg,build