跳到内容

配置

tox-ansible 应该使用 tox-ansible.ini 文件进行配置。使用 tox-ansible.ini 文件允许将 tox-ansible 插件引入到可能已经存在 tox 配置而没有冲突的存储库中。如果不需要配置覆盖,则 tox-ansible.ini 文件可以为空,但应该存在。除了所有 tox 支持的关键字外,还提供了 ansible 部分和 skip 关键字

# tox-ansible.ini
[ansible]
skip =
    2.9
    devel

这将跳过任何使用 Ansible 2.9 或 devel 分支的环境中的测试。字符串列表用于环境名称的简单字符串比较。

覆盖配置

[testenv] 部分或环境部分 [testenv:integration-py3.11-{devel,milestone}] 中的任何配置都可以覆盖 tox-ansible 环境配置的部分或全部。

例如

[testenv]
commands_pre =
    true

[testenv:integration-py3.11-{devel,milestone}]
commands =
    true

将导致

# tox-ansible.ini
[testenv:integration-py3.11-devel]
commands_pre = true
commands = true

如果不谨慎使用,此配置可能会导致意外行为,以及可能的误报或漏报测试结果。