Пример #1
0
def test_report_level():
    level = ReportLevel.get_by_name("MESSAGE")
    assert level == ReportLevel.MESSAGE
    level = ReportLevel.get_by_name("DIFFERENT")
    assert level is None
    level = ReportLevel.get_by_name("DIFFERENT", ReportLevel.MESSAGE)
    assert level == ReportLevel.MESSAGE
    levels = ReportLevel.get_names()
    assert len(levels) == 4
Пример #2
0
def get_builder_exceptions_report_level(
        config: NormalizedConfig) -> ReportLevel:
    orig_report_level = None
    try:
        orig_report_level = config.globals["runtime"]["builder"][
            "exceptions_report_level"]
    except KeyError:
        pass
    if orig_report_level is not None:
        report_level = ReportLevel.get_by_name(orig_report_level)
        if report_level is None:
            raise ValueError(
                "Invalid 'runtime.builder.exceptions_report_level' value '%s'"
                % orig_report_level)
    else:
        report_level = DEFAULT_BUILDER_EXCEPTIONS_REPORT_LEVEL
    return report_level