本文整理汇总了Python中avocado.core.output.LOG_UI.debug方法的典型用法代码示例。如果您正苦于以下问题:Python LOG_UI.debug方法的具体用法?Python LOG_UI.debug怎么用?Python LOG_UI.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类avocado.core.output.LOG_UI
的用法示例。
在下文中一共展示了LOG_UI.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def run(self, args):
"""
Print libexec path and finish
:param args: Command line args received from the run subparser.
"""
LOG_UI.debug(resource_filename("avocado", "libexec"))
示例2: test_progress
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def test_progress(self, progress=False):
if not self.owns_stdout:
return
if progress:
color = output.TERM_SUPPORT.PASS
else:
color = output.TERM_SUPPORT.PARTIAL
LOG_UI.debug(color + self.__throbber.render() +
output.TERM_SUPPORT.ENDC, extra={"skip_newline": True})
示例3: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def run(self, args):
"""
Print libexec path and finish
:param args: Command line args received from the run subparser.
"""
system_wide = '/usr/libexec/avocado'
if os.path.isdir(system_wide):
LOG_UI.debug(system_wide)
else:
LOG_UI.debug(resource_filename("avocado", "libexec"))
示例4: end_test
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def end_test(self, result, state):
if not self.owns_stdout:
return
status = state.get("status", "ERROR")
if status == "TEST_NA":
status = "SKIP"
duration = (" (%.2f s)" % state.get('time_elapsed', -1)
if status != "SKIP"
else "")
msg = self.get_colored_status(status, state.get("fail_reason", None))
LOG_UI.debug(msg + duration)
示例5: start_test
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def start_test(self, result, state):
if not self.owns_stdout:
return
if "name" in state:
name = state["name"]
uid = name.str_uid
name = name.name + name.str_variant
else:
name = "<unknown>"
uid = '?'
LOG_UI.debug(' (%s/%s) %s: ', uid, result.tests_total, name,
extra={"skip_newline": True})
示例6: end_test
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def end_test(self, result, state):
if not self.owns_stdout:
return
status = state.get("status", "ERROR")
if status == "TEST_NA":
status = "SKIP"
duration = (" (%.2f s)" % state.get('time_elapsed', -1)
if status != "SKIP"
else "")
LOG_UI.debug(output.TERM_SUPPORT.MOVE_BACK +
self.output_mapping[status] +
status + output.TERM_SUPPORT.ENDC +
duration)
示例7: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def run(self, args):
err = None
if args.tree and args.varianter_debug:
err = "Option --tree is incompatible with --debug."
elif not args.tree and args.inherit:
err = "Option --inherit can be only used with --tree"
if err:
LOG_UI.error(err)
sys.exit(exit_codes.AVOCADO_FAIL)
varianter = args.avocado_variants
try:
varianter.parse(args)
except (IOError, ValueError) as details:
LOG_UI.error("Unable to parse varianter: %s", details)
sys.exit(exit_codes.AVOCADO_FAIL)
use_utf8 = settings.get_value("runner.output", "utf8",
key_type=bool, default=None)
summary = args.summary or 0
variants = args.variants or 0
# Parse obsolete options (unsafe to combine them with new args)
if args.tree:
variants = 0
summary += 1
if args.contents:
summary += 1
if args.inherit:
summary += 2
else:
if args.contents:
variants += 2
# Export the serialized avocado_variants
if args.json_variants_dump is not None:
try:
with open(args.json_variants_dump, 'w') as variants_file:
json.dump(args.avocado_variants.dump(), variants_file)
except IOError:
LOG_UI.error("Cannot write %s", args.json_variants_dump)
sys.exit(exit_codes.AVOCADO_FAIL)
# Produce the output
lines = args.avocado_variants.to_str(summary=summary,
variants=variants,
use_utf8=use_utf8)
for line in lines.splitlines():
LOG_UI.debug(line)
sys.exit(exit_codes.AVOCADO_ALL_OK)
示例8: render
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def render(self, result, job):
if not (hasattr(job.args, 'xunit_job_result') or
hasattr(job.args, 'xunit_output')):
return
if not result.tests_total:
return
content = self._render(result)
if getattr(job.args, 'xunit_job_result', 'off') == 'on':
xunit_path = os.path.join(job.logdir, 'results.xml')
with open(xunit_path, 'w') as xunit_file:
xunit_file.write(content)
xunit_path = getattr(job.args, 'xunit_output', 'None')
if xunit_path is not None:
if xunit_path == '-':
LOG_UI.debug(content)
else:
with open(xunit_path, 'w') as xunit_file:
xunit_file.write(content)
示例9: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def run(self, args):
if args.distro_def_create:
if not (args.distro_def_name and args.distro_def_version and
args.distro_def_arch and args.distro_def_type and
args.distro_def_path):
LOG_UI.error('Required arguments: name, version, arch, type '
'and path')
sys.exit(exit_codes.AVOCADO_FAIL)
output_file_name = self.get_output_file_name(args)
if os.path.exists(output_file_name):
error_msg = ('Output file "%s" already exists, will not '
'overwrite it', output_file_name)
LOG_UI.error(error_msg)
else:
LOG_UI.debug("Loading distro information from tree... "
"Please wait...")
distro = load_from_tree(args.distro_def_name,
args.distro_def_version,
args.distro_def_release,
args.distro_def_arch,
args.distro_def_type,
args.distro_def_path)
save_distro(distro, output_file_name)
LOG_UI.debug('Distro information saved to "%s"',
output_file_name)
else:
detected = utils_distro.detect()
LOG_UI.debug('Detected distribution: %s (%s) version %s release '
'%s', detected.name, detected.arch, detected.version,
detected.release)
示例10: render
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def render(self, result, job):
if not (hasattr(job.args, 'xunit_job_result') or
hasattr(job.args, 'xunit_output')):
return
if not result.tests_total:
return
max_test_log_size = getattr(job.args, 'xunit_max_test_log_chars', None)
job_name = getattr(job.args, 'xunit_job_name', None)
content = self._render(result, max_test_log_size, job_name)
if getattr(job.args, 'xunit_job_result', 'off') == 'on':
xunit_path = os.path.join(job.logdir, 'results.xml')
with open(xunit_path, 'wb') as xunit_file:
xunit_file.write(content)
xunit_path = getattr(job.args, 'xunit_output', 'None')
if xunit_path is not None:
if xunit_path == '-':
LOG_UI.debug(content.decode('UTF-8'))
else:
with open(xunit_path, 'wb') as xunit_file:
xunit_file.write(content)
示例11: _display
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def _display(self, test_matrix, stats, tag_stats):
header = None
if self.args.verbose:
header = (output.TERM_SUPPORT.header_str('Type'),
output.TERM_SUPPORT.header_str('Test'),
output.TERM_SUPPORT.header_str('Tag(s)'))
for line in astring.iter_tabular_output(test_matrix, header=header,
strip=True):
LOG_UI.debug(line)
if self.args.verbose:
LOG_UI.info("")
LOG_UI.info("TEST TYPES SUMMARY")
LOG_UI.info("==================")
for key in sorted(stats):
LOG_UI.info("%s: %s", key.upper(), stats[key])
if tag_stats:
LOG_UI.info("")
LOG_UI.info("TEST TAGS SUMMARY")
LOG_UI.info("=================")
for key in sorted(tag_stats):
LOG_UI.info("%s: %s", key, tag_stats[key])
示例12: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def run(self, args):
"""
Print libexec path and finish
:param args: Command line args received from the run subparser.
"""
if 'VIRTUAL_ENV' in os.environ:
LOG_UI.debug('libexec')
elif os.path.exists('/usr/libexec/avocado'):
LOG_UI.debug('/usr/libexec/avocado')
elif os.path.exists('/usr/lib/avocado'):
LOG_UI.debug('/usr/lib/avocado')
else:
for path in os.environ.get('PATH').split(':'):
if (os.path.exists(os.path.join(path, 'avocado')) and
os.path.exists(os.path.join(os.path.dirname(path),
'libexec'))):
LOG_UI.debug(os.path.join(os.path.dirname(path), 'libexec'))
break
else:
LOG_UI.error("Can't locate avocado libexec path")
sys.exit(exit_codes.AVOCADO_FAIL)
return sys.exit(exit_codes.AVOCADO_ALL_OK)
示例13: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def run(self, args):
LOG_UI.info('Config files read (in order):')
for cfg_path in settings.config_paths:
LOG_UI.debug(' %s' % cfg_path)
if settings.config_paths_failed:
LOG_UI.error('\nConfig files that failed to read:')
for cfg_path in settings.config_paths_failed:
LOG_UI.error(' %s' % cfg_path)
LOG_UI.debug("")
if not args.datadir:
blength = 0
for section in settings.config.sections():
for value in settings.config.items(section):
clength = len('%s.%s' % (section, value[0]))
if clength > blength:
blength = clength
format_str = " %-" + str(blength) + "s %s"
LOG_UI.debug(format_str, 'Section.Key', 'Value')
for section in settings.config.sections():
for value in settings.config.items(section):
config_key = ".".join((section, value[0]))
LOG_UI.debug(format_str, config_key, value[1])
else:
LOG_UI.debug("Avocado replaces config dirs that can't be accessed")
LOG_UI.debug("with sensible defaults. Please edit your local config")
LOG_UI.debug("file to customize values")
LOG_UI.debug('')
LOG_UI.info('Avocado Data Directories:')
LOG_UI.debug(' base ' + data_dir.get_base_dir())
LOG_UI.debug(' tests ' + data_dir.get_test_dir())
LOG_UI.debug(' data ' + data_dir.get_data_dir())
LOG_UI.debug(' logs ' + data_dir.get_logs_dir())
LOG_UI.debug(' cache ' + ", ".join(data_dir.get_cache_dirs()))
示例14: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
#.........这里部分代码省略.........
sysinfo_post2 = self._get_sysinfo(job2_dir, 'post')
if str(sysinfo_post1) != str(sysinfo_post2):
sysinfo_header_post = ['\n',
'# SYSINFO POST\n']
job1_results.extend(sysinfo_header_post)
job1_results.extend(sysinfo_post1)
job2_results.extend(sysinfo_header_post)
job2_results.extend(sysinfo_post2)
if getattr(args, 'create_reports', False):
self.std_diff_output = False
prefix = 'avocado_diff_%s_' % job1_id[:7]
tmp_file1 = tempfile.NamedTemporaryFile(mode='w',
prefix=prefix,
suffix='.txt',
delete=False)
tmp_file1.writelines(job1_results)
tmp_file1.close()
prefix = 'avocado_diff_%s_' % job2_id[:7]
tmp_file2 = tempfile.NamedTemporaryFile(mode='w',
prefix=prefix,
suffix='.txt',
delete=False)
tmp_file2.writelines(job2_results)
tmp_file2.close()
LOG_UI.info('%s %s', tmp_file1.name, tmp_file2.name)
if (getattr(args, 'open_browser', False) and
getattr(args, 'html', None) is None):
prefix = 'avocado_diff_%s_%s_' % (job1_id[:7], job2_id[:7])
tmp_file = tempfile.NamedTemporaryFile(mode='w',
prefix=prefix,
suffix='.html',
delete=False)
setattr(args, 'html', tmp_file.name)
if getattr(args, 'html', None) is not None:
self.std_diff_output = False
try:
html_diff = HtmlDiff()
html_diff._legend = """
<table class="diff" summary="Legends">
<tr> <td> <table border="" summary="Colors">
<tr><th> Colors </th> </tr>
<tr><td class="diff_add"> Added </td></tr>
<tr><td class="diff_chg">Changed</td> </tr>
<tr><td class="diff_sub">Deleted</td> </tr>
</table></td>
<td> <table border="" summary="Links">
<tr><th colspan="2"> Links </th> </tr>
<tr><td>(f)irst change</td> </tr>
<tr><td>(n)ext change</td> </tr>
<tr><td>(t)op</td> </tr>
</table></td> </tr>
</table>"""
job_diff_html = html_diff.make_file((_.decode("utf-8")
for _ in job1_results),
(_.decode("utf-8")
for _ in job2_results),
fromdesc=job1_id,
todesc=job2_id)
with open(args.html, 'w') as html_file:
html_file.writelines(job_diff_html.encode("utf-8"))
LOG_UI.info(args.html)
except IOError as exception:
LOG_UI.error(exception)
sys.exit(exit_codes.AVOCADO_FAIL)
if getattr(args, 'open_browser', False):
setsid = getattr(os, 'setsid', None)
if not setsid:
setsid = getattr(os, 'setpgrp', None)
with open(os.devnull, "r+") as inout:
cmd = ['xdg-open', args.html]
subprocess.Popen(cmd, close_fds=True, stdin=inout,
stdout=inout, stderr=inout,
preexec_fn=setsid)
if self.std_diff_output:
if self.term.enabled:
for line in self._cdiff(unified_diff(job1_results,
job2_results,
fromfile=job1_id,
tofile=job2_id)):
LOG_UI.debug(line.strip())
else:
for line in unified_diff(job1_results,
job2_results,
fromfile=job1_id,
tofile=job2_id):
LOG_UI.debug(line.strip())
示例15: run
# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import debug [as 别名]
def run(self, args):
LOG_UI.info("Config files read (in order, '*' means the file exists "
"and had been read):")
for cfg_path in settings.all_config_paths:
if cfg_path in settings.config_paths:
LOG_UI.debug(' * %s', cfg_path)
else:
LOG_UI.debug(' %s', cfg_path)
LOG_UI.debug("")
if not args.datadir:
blength = 0
for section in settings.config.sections():
for value in settings.config.items(section):
clength = len('%s.%s' % (section, value[0]))
if clength > blength:
blength = clength
format_str = " %-" + str(blength) + "s %s"
LOG_UI.debug(format_str, 'Section.Key', 'Value')
for section in settings.config.sections():
for value in settings.config.items(section):
config_key = ".".join((section, value[0]))
LOG_UI.debug(format_str, config_key, value[1])
else:
LOG_UI.debug("Avocado replaces config dirs that can't be accessed")
LOG_UI.debug("with sensible defaults. Please edit your local config")
LOG_UI.debug("file to customize values")
LOG_UI.debug('')
LOG_UI.info('Avocado Data Directories:')
LOG_UI.debug(' base %s', data_dir.get_base_dir())
LOG_UI.debug(' tests %s', data_dir.get_test_dir())
LOG_UI.debug(' data %s', data_dir.get_data_dir())
LOG_UI.debug(' logs %s', data_dir.get_logs_dir())
LOG_UI.debug(' cache %s', ", ".join(data_dir.get_cache_dirs()))