【发布时间】:2019-10-01 14:10:00
【问题描述】:
所以我克隆了 ansible 存储库并使用 venv 进行了设置。而且我想运行特定的模块/包单元测试(如果我没有指定任何模式或指定特定文件,它确实会完全运行单元测试)。
我尝试了这些变体(前两个不起作用):
第一:
source venv/bin/activate && source hacking/env-setup && ansible-test units --tox --python 3.6 google
ERROR: Target pattern not matched: google
第二:
source venv/bin/activate && source hacking/env-setup && ansible-test units --tox --python 3.6 cloud
ERROR: Target pattern not matched: cloud
第三:
source venv/bin/activate && source hacking/env-setup && ansible-test units --tox --python 3.6 test/units/modules/cloud/google/test_gce_tag.py
...
- generated xml file: /home/oerp/src/ansible/test/results/junit/python3.6-units.xml -
============================== 3 passed in 1.68s ===============================
___________________________________ summary ____________________________________
py36: commands succeeded
congratulations :)
文档中有一个示例,展示了如何为特定文件运行测试:
ansible-test units --tox --python 2.7 apt
也许我对那个示例的理解有误?或者我应该如何为 google 或整个组 cloud 运行包的单元测试?
更新。也试过test/units/modules/cloud/google,但得到同样的错误。
【问题讨论】:
标签: python unit-testing ansible tox