我有一个非常小的测试用例:
@pytest.mark.bar
def test_snapshot_missing_snapshot_capacity():
fault.clear_settings()
fault.load_settings("{0}/test/test_bar_snapshot_capacity_missing.json".format(constants.RECOVERY_DIR))
backup_ts = bar_snapshot.create_backup(cloud_storage_driver, cloud_storage_driver_md, hydra_client)
assert not backup_ts
test_bar_snapshot_capacity_missing.json
有:
{
"snapshot_capacity_missing": true
}
基本上我在这里注入了断层。
if fault.is_fault("snapshot_capacity_missing"):
log.error("One or more incomplete backup/s intended for deletion do not have snapshot capacity. \
Skipping deleting incomplete backup altogether.")
return None
我根本没有在控制台上打印log.error。即使在语句之前添加log.error,也不会打印它。我的测试用例通过了。是否需要进行特殊设置,以便日志语句可用于功能测试?