未验证 提交 fe88e25e 编写于 作者: R Rudá Moura

htmlresult: Graceful disable it if pystache is not installed.

Test for features HTML_REPORT_CAPABLE and HTML_REPORT_SUPPORT to
graceful disable the htmlreport if pystache is not installed.
Signed-off-by: NRudá Moura <rmoura@redhat.com>
上级 245f74e9
......@@ -40,14 +40,9 @@ from avocado.plugins import jsonresult
from avocado.plugins import xunit
from avocado.utils import archive
from avocado.utils import path
from avocado.plugins import htmlresult
try:
from avocado.plugins import htmlresult
HTML_REPORT_SUPPORT = True
except ImportError:
HTML_REPORT_SUPPORT = False
HTML_REPORT_SUPPORT = htmlresult.HTML_REPORT_CAPABLE
_NEW_ISSUE_LINK = 'https://github.com/avocado-framework/avocado/issues/new'
......
......@@ -21,7 +21,12 @@ import sys
import time
import webbrowser
import pystache
try:
import pystache
except ImportError:
HTML_REPORT_CAPABLE = False
else:
HTML_REPORT_CAPABLE = True
from avocado import runtime
from avocado.core import exit_codes
......@@ -248,6 +253,9 @@ class HTML(plugin.Plugin):
enabled = True
def configure(self, parser):
if HTML_REPORT_CAPABLE is False:
self.enabled = False
return
self.parser = parser
self.parser.runner.add_argument(
'--html', type=str,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册