本文整理汇总了Python中mpiunittest.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runtestsleak
def runtestsleak(repeats, *args, **kargs):
import gc
test = r1 = r2 = None
while repeats:
repeats -= 1
gc.collect()
r1 = sys.gettotalrefcount()
for test in alltests:
mpiunittest.main(test, *args, **kargs)
gc.collect()
r2 = sys.gettotalrefcount()
sys.stderr.flush()
sys.stderr.write('\nREF LEAKS -- before: %d, after: %d, diff: [%d]\n' % (r1, r2, r2-r1))
sys.stderr.flush()
示例2: testJson
self.do_pickle(obj, pickle)
self.do_pickle(OBJS2, pickle)
@unittest.skipIf(json is None, 'json')
def testJson(self):
pickle = self.pickle
dumps = lambda o: json.dumps(o).encode()
loads = lambda s: json.loads(tobytes(s).decode())
pickle.__init__(dumps, loads)
OBJS2 = [o for o in OBJS
if not isinstance(o, (float, complex, tuple))]
for obj in OBJS2:
self.do_pickle(obj, pickle)
self.do_pickle(OBJS2, pickle)
@unittest.skipIf(yaml is None, 'yaml')
def testYAML(self):
pickle = self.pickle
dumps = lambda o: yaml.dump(o).encode()
loads = lambda s: yaml.load(tobytes(s).decode())
pickle.__init__(dumps, loads)
OBJS2 = [o for o in OBJS
if not isinstance(o, (complex, tuple))]
for obj in OBJS2:
self.do_pickle(obj, pickle)
self.do_pickle(OBJS2, pickle)
if __name__ == '__main__':
unittest.main()
示例3: runtests
def runtests(*args, **kargs):
for test in alltests:
sys.stderr.flush()
sys.stderr.write("\nRunning %s\n" % test.__name__)
sys.stderr.flush()
mpiunittest.main(test, *args, **kargs)