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


Python Tester.test_pair方法代码示例

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


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

示例1: main

# 需要导入模块: from tester import Tester [as 别名]
# 或者: from tester.Tester import test_pair [as 别名]
def main(args):
    with file('arena.json', 'rb') as json_f:
        config = json.load(json_f)
    svc_list = config['services']
    cns_list = config['consumers']
    sts_list = config['suites']
    if len(args) < 2:
        exit_errmsg(USAGE.format(progname=args[0],
			services=usage_format(svc_list),
            consumers=usage_format(cns_list),
            suites=usage_format(sts_list)))
    else:
        tst = Tester()
        if args[1] == 'test':
            svc_name, cns_name = args[2:4]
            tst.test_pair(resolve(svc_list, svc_name, 'service'),
                    resolve(cns_list, cns_name, 'consumer'))
        elif args[1] == 'clean':
            tst.clean(config[args[2] + 's'][args[3]])
        elif args[1] == 'measure':
            if len(args) < 3:
                suites = sts_list.itervalues()
            else:
                suites = [resolve(sts_list, args[2], 'suite')]
            if len(args) < 4:
                repeats = config['measurement']['repeats']
            else:
                repeats = [int(args[3])]
            if len(args) < 5:
                runs = config['measurement']['runs']
            else:
                runs = int(args[4])
            measure(suites, repeats, runs, svc_list, cns_list)
        else:
            exit_errmsg('Invalid command: "{0}"'.format(args[1]))
开发者ID:dnet,项目名称:wsse-arena,代码行数:37,代码来源:arena.py

示例2: measure

# 需要导入模块: from tester import Tester [as 别名]
# 或者: from tester.Tester import test_pair [as 别名]
def measure(suites, repeats, runs, svc_list, cns_list):
    filebase = datetime.now().strftime(FILE_FORMAT)
    log = LogFile(filebase)
    csv = path.join(getcwd(), filebase + CSV_SUFFIX)
    with file(csv, 'w') as f:
        f.write('Service;Consumer;Repeats;Suite;Initialization;Invocation')
    for suite, repeat, (svc_name, service), (cns_name, consumer), num in product(
            suites, repeats, svc_list.iteritems(), cns_list.iteritems(), xrange(runs)):
        log.log('{0} using {1} -({2}x)-> {3}, try {4}'.format(
            suite['title'], cns_name, repeat, svc_name, num + 1))
        tst = Tester()
        env = dict(TIMES=str(repeat), CSV_FILE=csv, CSV_PREFIX=';'.join(
            (svc_name, cns_name, str(repeat), suite['title'])))
        for i in suite['env']:
            env[i] = '1'
        tst.extend_env(env)
        tst.test_pair(service, consumer)
开发者ID:dnet,项目名称:wsse-arena,代码行数:19,代码来源:meter.py


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