本文整理汇总了Python中bzt.jmx.JMX._get_dur_assertion方法的典型用法代码示例。如果您正苦于以下问题:Python JMX._get_dur_assertion方法的具体用法?Python JMX._get_dur_assertion怎么用?Python JMX._get_dur_assertion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bzt.jmx.JMX
的用法示例。
在下文中一共展示了JMX._get_dur_assertion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compile_request
# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_dur_assertion [as 别名]
def compile_request(self, request):
"""
:type request: HierarchicHTTPRequest
:return:
"""
sampler = children = None
protocol_name = request.priority_option('protocol', default=self.default_protocol)
if protocol_name in self.protocol_handlers:
protocol = self.protocol_handlers[protocol_name]
sampler, children = protocol.get_sampler_pair(request)
if sampler is None:
self.log.warning("Problematic request: %s", request.config)
raise TaurusInternalException("Unable to handle request, please review missing options")
children.extend(self._get_timer(request))
self.__add_assertions(children, request)
timeout = ProtocolHandler.safe_time(request.priority_option('timeout'))
if timeout is not None:
children.append(JMX._get_dur_assertion(timeout))
children.append(etree.Element("hashTree"))
self.__add_extractors(children, request)
self.__add_jsr_elements(children, request)
return [sampler, children]
示例2: compile_http_request
# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_dur_assertion [as 别名]
def compile_http_request(self, request):
"""
:type request: HierarchicHTTPRequest
:return:
"""
timeout = request.priority_option('timeout')
if timeout is not None:
timeout = self.smart_time(timeout)
content_type = self._get_merged_ci_headers(request, 'content-type')
if content_type == 'application/json' and isinstance(request.body, (dict, list)):
body = json.dumps(request.body)
else:
body = request.body
use_random_host_ip = request.priority_option('random-source-ip', default=False)
host_ips = get_host_ips(filter_loopbacks=True) if use_random_host_ip else []
http = JMX._get_http_request(request.url, request.label, request.method, timeout, body,
request.priority_option('keepalive', default=True),
request.upload_files, request.content_encoding,
request.priority_option('follow-redirects', default=True),
use_random_host_ip, host_ips)
children = etree.Element("hashTree")
if request.headers:
children.append(JMX._get_header_mgr(request.headers))
children.append(etree.Element("hashTree"))
self.__add_think_time(children, request)
self.__add_assertions(children, request)
if timeout is not None:
children.append(JMX._get_dur_assertion(timeout))
children.append(etree.Element("hashTree"))
self.__add_extractors(children, request)
self.__add_jsr_elements(children, request)
return [http, children]