本文整理汇总了Python中linaro_dashboard_bundle.io.DocumentIO.dumps方法的典型用法代码示例。如果您正苦于以下问题:Python DocumentIO.dumps方法的具体用法?Python DocumentIO.dumps怎么用?Python DocumentIO.dumps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类linaro_dashboard_bundle.io.DocumentIO
的用法示例。
在下文中一共展示了DocumentIO.dumps方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: invoke_sub
# 需要导入模块: from linaro_dashboard_bundle.io import DocumentIO [as 别名]
# 或者: from linaro_dashboard_bundle.io.DocumentIO import dumps [as 别名]
def invoke_sub(self):
bundle = generate_combined_bundle(self.args.serial,
self.args.result_id)
try:
print DocumentIO.dumps(bundle)
except IOError:
pass
示例2: _savetestdata
# 需要导入模块: from linaro_dashboard_bundle.io import DocumentIO [as 别名]
# 或者: from linaro_dashboard_bundle.io.DocumentIO import dumps [as 别名]
def _savetestdata(self, analyzer_assigned_uuid, run_options=""):
config = get_config()
TIMEFORMAT = '%Y-%m-%dT%H:%M:%SZ'
bundle = {
'format': config.bundle_format,
'test_runs': [
{
'analyzer_assigned_uuid': analyzer_assigned_uuid,
'analyzer_assigned_date':
self.runner.starttime.strftime(TIMEFORMAT),
'time_check_performed': False,
'attributes':{},
'test_id': self.testname,
'test_results':[],
'attachments':[],
'hardware_context': hwprofile.get_hardware_context(self.adb),
'software_context': swprofile.get_software_context(self.adb)
}
]
}
if run_options:
bundle['test_runs'][0]['attributes']['run_options'] = run_options
self._add_install_options(bundle, config)
filename_host = os.path.join(config.tempdir_host, 'testdata.json')
write_file(DocumentIO.dumps(bundle), filename_host)
filename_target = os.path.join(self.resultsdir, 'testdata.json')
self.adb.push(filename_host, filename_target)
示例3: test_load_and_save_does_not_clobber_the_data
# 需要导入模块: from linaro_dashboard_bundle.io import DocumentIO [as 别名]
# 或者: from linaro_dashboard_bundle.io.DocumentIO import dumps [as 别名]
def test_load_and_save_does_not_clobber_the_data(self):
original_text = resource_string(
'linaro_dashboard_bundle', 'test_documents/' +
self.filename)
fmt, doc = DocumentIO.loads(original_text)
final_text = DocumentIO.dumps(doc,)
final_text += "\n" # the original string has newline at the end
self.assertEqual(final_text, original_text)
示例4: submit_bundle
# 需要导入模块: from linaro_dashboard_bundle.io import DocumentIO [as 别名]
# 或者: from linaro_dashboard_bundle.io.DocumentIO import dumps [as 别名]
def submit_bundle(self, main_bundle, server, stream, token):
dashboard = _get_dashboard(server, token)
json_bundle = DocumentIO.dumps(main_bundle)
job_name = self.context.job_data.get('job_name', "LAVA Results")
try:
result = dashboard.put_ex(json_bundle, job_name, stream)
print >> self.context.oob_file, 'dashboard-put-result:', result
self.context.output.write_named_data('result-bundle', result)
logging.info("Dashboard : %s" % result)
except xmlrpclib.Fault, err:
logging.warning("xmlrpclib.Fault occurred")
logging.warning("Fault code: %d" % err.faultCode)
logging.warning("Fault string: %s" % err.faultString)
raise OperationFailed("could not push to dashboard")
示例5: test_dumper_can_dump_decimals
# 需要导入模块: from linaro_dashboard_bundle.io import DocumentIO [as 别名]
# 或者: from linaro_dashboard_bundle.io.DocumentIO import dumps [as 别名]
def test_dumper_can_dump_decimals(self):
doc = {
"format": "Dashboard Bundle Format 1.0",
"test_runs": [
{
"test_id": "NOT RELEVANT",
"analyzer_assigned_date": "2010-11-14T01:03:06Z",
"analyzer_assigned_uuid": "NOT RELEVANT",
"time_check_performed": False,
"test_results": [
{
"test_case_id": "NOT RELEVANT",
"result": "unknown",
"measurement": Decimal("1.5")
}
]
}
]
}
text = DocumentIO.dumps(doc)
self.assertIn("1.5", text)
示例6: test_dumps_produces_compact_sorted_ouptut
# 需要导入模块: from linaro_dashboard_bundle.io import DocumentIO [as 别名]
# 或者: from linaro_dashboard_bundle.io.DocumentIO import dumps [as 别名]
def test_dumps_produces_compact_sorted_ouptut(self):
observed_text = DocumentIO.dumps(self.doc, human_readable=False, sort_keys=True)
self.assertEqual(observed_text, self.expected_compact_sorted_text)
示例7: test_dumps_produces_readable_ouptut
# 需要导入模块: from linaro_dashboard_bundle.io import DocumentIO [as 别名]
# 或者: from linaro_dashboard_bundle.io.DocumentIO import dumps [as 别名]
def test_dumps_produces_readable_ouptut(self):
observed_text = DocumentIO.dumps(self.doc, human_readable=True)
self.assertEqual(observed_text, self.expected_readable_text)