提交 fde9fc30 编写于 作者: L Lukáš Doktor

varianter: Report default variant on "to_str" method

When Varianter plugins report no variants, default is provided by
Varianter on `itertests`. The same needs to be emulated in case of
`to_str`, otherwise users would not get the same results as during
`run`.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 6195da68
......@@ -467,6 +467,16 @@ class Varianter(object):
:param kwargs: Other free-form arguments
:rtype: str
"""
if self._no_variants == 0: # No variants, only defaults:
out = []
if summary:
out.append("No variants available, using defaults only")
if variants:
variant = next(self.itertests())
variant["variant_id"] = "" # Don't confuse people with None
out.append("\n".join(variant_to_str(variant, variants - 1,
kwargs, self.debug)))
return "\n\n".join(out)
return "\n\n".join(self._variant_plugins.map_method("to_str", summary,
variants,
**kwargs))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册