本文整理汇总了Python中validator.errorbundler.ErrorBundle.overrides方法的典型用法代码示例。如果您正苦于以下问题:Python ErrorBundle.overrides方法的具体用法?Python ErrorBundle.overrides怎么用?Python ErrorBundle.overrides使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.errorbundler.ErrorBundle
的用法示例。
在下文中一共展示了ErrorBundle.overrides方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _run_test_raw
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import overrides [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
示例2: _do_test_raw
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import overrides [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)
return err
示例3: _do_test_raw
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import overrides [as 别名]
def _do_test_raw(rdf, listed=True, overrides=None):
err = ErrorBundle(listed=listed)
err.overrides = overrides
rdf = RDFParser(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
示例4: validate
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import overrides [as 别名]
def validate(path, format="json",
approved_applications=os.path.join(os.path.dirname(__file__),
"app_versions.json"),
determined=True,
spidermonkey=False,
listed=True,
expectation=PACKAGE_ANY,
for_appversions=None,
overrides=None):
"""
Perform validation in one easy step!
format : The format to output the results in
approved_applications : Path to the list of approved application versions
determined : Whether the validator should continue after a tier fails
spidermonkey : Path to the local spidermonkey installation (Default: False)
listed : True if the add-on is destined for AMO, false if not
expectation : The type of package that should be expected
for_appversions : A dict of app GUIDs referencing lists of versions.
Determines which version-dependant tests should be run.
"""
# Load up the target applications
apps = json.load(open(approved_applications))
validator.constants.APPROVED_APPLICATIONS.clear()
validator.constants.APPROVED_APPLICATIONS.update(apps)
bundle = ErrorBundle(listed=listed, determined=determined)
if overrides:
bundle.overrides = overrides
if spidermonkey != False:
bundle.save_resource("SPIDERMONKEY", spidermonkey)
validator.submain.prepare_package(bundle, path, expectation,
for_appversions=for_appversions)
# Write the results to the pipe
formats = {"json": lambda b: b.render_json()}
if format is not None:
return formats[format](bundle)
else:
return bundle
示例5: _run_test_raw
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import overrides [as 别名]
def _run_test_raw(data, failure=True, detected_type=0, listed=True,
overrides=None):
"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
parser = RDFParser(data)
installrdf._test_rdf(err, parser)
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