本文整理汇总了Python中Testing.isTest方法的典型用法代码示例。如果您正苦于以下问题:Python Testing.isTest方法的具体用法?Python Testing.isTest怎么用?Python Testing.isTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Testing
的用法示例。
在下文中一共展示了Testing.isTest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _print
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import isTest [as 别名]
def _print(msgtype, pkg, reason, details):
global _badness_score
threshold = badnessThreshold()
badness = 0
if threshold >= 0:
badness = Config.badness(reason)
# anything with badness is an error
if badness:
msgtype = 'E'
# errors without badness become warnings
elif msgtype == 'E':
msgtype = 'W'
ln = ""
if pkg.current_linenum is not None:
ln = "%s:" % pkg.current_linenum
arch = ""
if pkg.arch is not None:
arch = ".%s" % pkg.arch
s = "%s%s:%s %s: %s" % (pkg.name, arch, ln, msgtype, reason)
if badness:
s = s + " (Badness: %d)" % badness
for d in details:
s = s + " %s" % d
if Testing and Testing.isTest():
Testing.addOutput(s)
else:
if _rawout:
print(s.encode(locale.getpreferredencoding(), "replace"),
file=_rawout)
if not Config.isFiltered(s):
printed_messages[msgtype] += 1
_badness_score += badness
if threshold >= 0:
_diagnostic.append(s + "\n")
else:
__print(s)
if Config.info:
printDescriptions(reason)
return True
return False