当前位置: 首页>>代码示例>>Python>>正文


Python EventBuilder.event_for_job_test_add_error方法代码示例

本文整理汇总了Python中lldbsuite.test_event.event_builder.EventBuilder.event_for_job_test_add_error方法的典型用法代码示例。如果您正苦于以下问题:Python EventBuilder.event_for_job_test_add_error方法的具体用法?Python EventBuilder.event_for_job_test_add_error怎么用?Python EventBuilder.event_for_job_test_add_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lldbsuite.test_event.event_builder.EventBuilder的用法示例。


在下文中一共展示了EventBuilder.event_for_job_test_add_error方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: visit

# 需要导入模块: from lldbsuite.test_event.event_builder import EventBuilder [as 别名]
# 或者: from lldbsuite.test_event.event_builder.EventBuilder import event_for_job_test_add_error [as 别名]
def visit(prefix, dir, names):
    """Visitor function for os.path.walk(path, visit, arg)."""

    dir_components = set(dir.split(os.sep))
    excluded_components = set(['.svn', '.git'])
    if dir_components.intersection(excluded_components):
        return

    # Gather all the Python test file names that follow the Test*.py pattern.
    python_test_files = [
        name
        for name in names
        if name.endswith('.py') and name.startswith(prefix)]

    # Visit all the python test files.
    for name in python_test_files:
        try:
            # Ensure we error out if we have multiple tests with the same
            # base name.
            # Future improvement: find all the places where we work with base
            # names and convert to full paths.  We have directory structure
            # to disambiguate these, so we shouldn't need this constraint.
            if name in configuration.all_tests:
                raise Exception("Found multiple tests with the name %s" % name)
            configuration.all_tests.add(name)

            # Run the relevant tests in the python file.
            visit_file(dir, name)
        except Exception as ex:
            # Convert this exception to a test event error for the file.
            test_filename = os.path.abspath(os.path.join(dir, name))
            if configuration.results_formatter_object is not None:
                # Grab the backtrace for the exception.
                import traceback
                backtrace = traceback.format_exc()

                # Generate the test event.
                configuration.results_formatter_object.handle_event(
                    EventBuilder.event_for_job_test_add_error(
                        test_filename, ex, backtrace))
            raise
开发者ID:karwa,项目名称:swift-lldb,代码行数:43,代码来源:dotest.py


注:本文中的lldbsuite.test_event.event_builder.EventBuilder.event_for_job_test_add_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。