我正在用分子来测试一个不可测的角色。我用python编写了单元测试,并且无法打印变量或将任何内容记录到stdout。这是我的密码
import os
import testinfra.utils.ansible_runner
import logging
LOG = logging.getLogger("toto")
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_something(host):
print 'Hello World!'
LOG.warn('Hello World!')
assert True发布于 2018-11-20 11:23:03
在s molecule.yml中为testinfra启用标志
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: instance
image: centos:7
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8
options:
s: truehttps://stackoverflow.com/questions/52879928
复制相似问题