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


Python ErrorBundle.print_summary方法代码示例

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


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

示例1: _do_test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def _do_test(path, test, failure=True,
             require_install=False, set_type=0,
             listed=False, xpi_mode="r"):

    package_data = open(path, "rb")
    package = XPIManager(package_data, mode=xpi_mode, name=path)
    err = ErrorBundle()
    if listed:
        err.save_resource("listed", True)

    # Populate in the dependencies.
    if set_type:
        err.detected_type = set_type # Conduit test requires type
    if require_install:
        err.save_resource("has_install_rdf", True)
        rdf_data = package.read("install.rdf")
        install_rdf = RDFParser(err, rdf_data)
        err.save_resource("install_rdf", install_rdf)

    populate_chrome_manifest(err, package)

    test(err, package)

    print err.print_summary(verbose=True)

    if failure:
        assert err.failed()
    else:
        assert not err.failed()

    return err
开发者ID:dimonov,项目名称:amo-validator,代码行数:33,代码来源:helper.py

示例2: test_webapp_pass

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_webapp_pass():
    """Test that a bland webapp file throws no errors."""

    err = ErrorBundle()
    validator.webapp.detect_webapp(err, json.dumps(_get_json()))
    print err.print_summary(verbose=True)
    assert not err.failed()
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:9,代码来源:test_webapp.py

示例3: _do_test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def _do_test(path, test, failure=True,
             require_install=False, set_type=0):
    
    package_data = open(path, "rb")
    package = XPIManager(package_data, path)
    contents = package.get_file_data()
    err = ErrorBundle()
    
    # Populate in the dependencies.
    if set_type:
        err.set_type(set_type) # Conduit test requires type
    if require_install:
        err.save_resource("has_install_rdf", True)
        rdf_data = package.read("install.rdf")
        install_rdf = RDFParser(rdf_data)
        err.save_resource("install_rdf", install_rdf)
    
    test(err, contents, package)
    
    print err.print_summary(verbose=True)
    
    if failure:
        assert err.failed()
    else:
        assert not err.failed()
    
    return err
开发者ID:nmaier,项目名称:amo-validator,代码行数:29,代码来源:helper.py

示例4: test_structure

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
 def test_structure(structure):
     err = ErrorBundle()
     err.supported_versions = {}
     mock_package = MockXPI(structure)
     content.test_packed_packages(err, mock_package)
     print err.print_summary(verbose=True)
     assert err.failed()
开发者ID:l-hedgehog,项目名称:amo-validator,代码行数:9,代码来源:test_content.py

示例5: _run_test_raw

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def _run_test_raw(data, failure=True, detected_type=0, listed=True,
                  overrides=None, compat=False):
    "Runs a test on an install.rdf snippet"

    data = data.strip()

    err = ErrorBundle()
    err.detected_type = detected_type
    err.save_resource("listed", listed)
    err.overrides = overrides

    if compat:
        err.save_resource("is_compat_test", True)

    err.save_resource("has_install_rdf", True)
    err.save_resource("install_rdf", RDFParser(err, data))
    installrdf.test_install_rdf_params(err)

    print err.print_summary(verbose=True)

    if failure:  # pragma: no cover
        assert err.failed() or err.notices
    else:
        assert not err.failed() and not err.notices

    return err
开发者ID:arcticlab,项目名称:amo-validator,代码行数:28,代码来源:test_installrdf.py

示例6: test_webapp_pass

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_webapp_pass():
    """Test that a bland webapp file throws no errors."""

    err = ErrorBundle()
    _detect(err, _get_json())
    print err.print_summary(verbose=True)
    assert not err.failed()
开发者ID:krupa,项目名称:amo-validator,代码行数:9,代码来源:test_webapp.py

示例7: test_webapp_no_default_locale

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_webapp_no_default_locale():
    """Test that locales require default_locale."""

    err = ErrorBundle()
    data = _get_json()
    del data["default_locale"]
    _detect(err, data)
    print err.print_summary(verbose=True)
    assert err.failed()
开发者ID:krupa,项目名称:amo-validator,代码行数:11,代码来源:test_webapp.py

示例8: test_hidden_files

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_hidden_files(test_input):
    """Tests that hidden files are reported."""

    err = ErrorBundle()
    err.supported_versions = {}
    mock_package = MockXPI(test_input)
    content.test_packed_packages(err, mock_package)
    print err.print_summary(verbose=True)
    assert err.failed()
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:11,代码来源:test_content.py

示例9: _do_test_raw

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def _do_test_raw(rdf, listed=True, overrides=None):
    err = ErrorBundle(listed=listed)
    err.overrides = overrides
    rdf = RDFParser(err, rdf.strip())
    err.save_resource("has_install_rdf", True)
    err.save_resource("install_rdf", rdf)

    targetapp.test_targetedapplications(err)
    print err.print_summary()
    return err
开发者ID:KWierso,项目名称:amo-validator,代码行数:12,代码来源:test_targetapplication.py

示例10: test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
 def test(versions):
     err = ErrorBundle()
     err.supported_versions = versions
     parser = MarkupParser(err)
     parser.process(name,
                    data,
                    name.split(".")[-1])
     print err.print_summary(verbose=True)
     assert not err.failed()
     return err
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:12,代码来源:test_compatibility.py

示例11: test_skip_blacklisted_file

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_skip_blacklisted_file():
    """Ensure blacklisted files are skipped for processing."""

    package_data = open("tests/resources/libraryblacklist/errors.xpi")
    package = XPIManager(package_data, mode="r", name="errors.xpi")
    err = ErrorBundle()

    test_content.test_packed_packages(err, package)

    print err.print_summary()
    assert err.notices
    assert not err.failed()
开发者ID:Archaeopteryx,项目名称:amo-validator,代码行数:14,代码来源:test_libraryblacklist.py

示例12: _do_test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def _do_test(path, should_fail=False):

    data = open(path).read()
    err = ErrorBundle()

    csstester.test_css_file(err, "css.css", data)
    err.print_summary(True)

    if should_fail:
        assert err.failed()
    else:
        assert not err.failed()

    return err
开发者ID:almet,项目名称:amo-validator,代码行数:16,代码来源:test_markup_csstester.py

示例13: test_package_corrupt

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_package_corrupt():
    "Tests the test_package function fails with a non-zip"
    
    tip = submain.test_inner_package
    submain.test_inner_package = lambda x, y, z: "success"
    
    name = "tests/resources/junk.xpi"
    err = ErrorBundle(None, True)
    
    result = submain.test_package(err, name, name)
    submain.test_inner_package = tip
    
    err.print_summary(True);
    assert err.failed()
开发者ID:nmaier,项目名称:amo-validator,代码行数:16,代码来源:test_submain_package.py

示例14: test_package_corrupt

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_package_corrupt():
    "Tests the test_package function fails with a corrupt file"

    tip = submain.test_inner_package
    submain.test_inner_package = lambda x, z, for_appversions: "success"

    name = "tests/resources/corrupt.xpi"
    err = ErrorBundle()

    result = submain.test_package(err, name, name)
    submain.test_inner_package = tip

    err.print_summary(True);
    assert err.failed()
开发者ID:Archaeopteryx,项目名称:amo-validator,代码行数:16,代码来源:test_submain_package.py

示例15: test_blacklisted_files

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import print_summary [as 别名]
def test_blacklisted_files():
    """Tests the validator's ability to hash each individual file and
    (based on this information) determine whether the addon passes or
    fails the validation process."""

    package_data = open("tests/resources/libraryblacklist/blocked.xpi")
    package = XPIManager(package_data, "blocked.xpi")
    contents = package.get_file_data()
    err = ErrorBundle()

    libblacklist.test_library_blacklist(err, contents, package)

    print err.print_summary()

    assert err.notices
开发者ID:nmaier,项目名称:amo-validator,代码行数:17,代码来源:test_libraryblacklist.py


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