首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在分子中使用testinfra作为验证器时,如何调试测试

在分子中使用testinfra作为验证器时,如何调试测试
EN

Stack Overflow用户
提问于 2019-11-23 00:12:27
回答 1查看 1.4K关注 0票数 1

当使用分子工具测试ansible角色并使用testinfra(pytest)验证结果时,我无法打印或调试某些输出或ansible变量。

代码语言:javascript
复制
============================= test session starts ==============================
platform linux2 -- Python 2.7.5, pytest-4.6.6, py-1.8.0, pluggy-0.13.0 -- /root/test1/myenv/bin/python2
using: pytest-4.6.6 pylib-1.8.0
setuptools registered plugins:
  testinfra-3.2.1 at /root/test1/myenv/lib/python2.7/site-packages/testinfra/plugin.py
rootdir: /root/test1/server_manager/molecule/default
plugins: testinfra-3.2.1
collected 1 item

tests/test_default.py::test_Ansible_variable[ansible://instance] PASSED  [100%]

=========================== 1 passed in 3.29 seconds ===========================

有没有办法做到这一点?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-04 21:06:01

molecule.yml文件中的testinfra验证器组件下,启用“s”选项。例如:

代码语言:javascript
复制
---
dependency:
  name: galaxy
driver:
  name: docker
lint:
  name: yamllint
platforms:
  - name: instance
    image: centos:7
provisioner:
  name: ansible
  lint:
    name: ansible-lint
verifier:
  name: testinfra
  lint:
    name: flake8
  options:
    s: true
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58997978

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档