diff --git a/tox-ansible.ini b/tox-ansible.ini new file mode 100644 index 00000000..741af07e --- /dev/null +++ b/tox-ansible.ini @@ -0,0 +1,30 @@ +[tox] +skipsdist = true + +[testenv] +# install core dependencies +deps = + ansible-core + ansible-dev-environment + pytest + pytest-ansible + +# allow mkdir and ln in commands_pre +allowlist_externals = + mkdir + ln + cd + +# Prepare temp ansible_collections path (some ansible-test checks may expect it) +commands_pre = + mkdir -p {envtmpdir}/ansible_collections/vyos + ln -s {toxinidir} {envtmpdir}/ansible_collections/vyos/vyos + +# Run tests from your actual repo +commands = + # run ansible-test sanity from repo root (avoids ADE) + cd {toxinidir} + ansible-test sanity || echo "Sanity skipped or empty" + + # run unit tests with pytest + python -m pytest --ansible-unit-inject-only {toxinidir}/tests/unit