本文整理汇总了Python中models.TestResult.get_or_insert_from_parsed_json方法的典型用法代码示例。如果您正苦于以下问题:Python TestResult.get_or_insert_from_parsed_json方法的具体用法?Python TestResult.get_or_insert_from_parsed_json怎么用?Python TestResult.get_or_insert_from_parsed_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.TestResult
的用法示例。
在下文中一共展示了TestResult.get_or_insert_from_parsed_json方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_merge
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def test_merge(self):
branch, platform, builder = _create_some_builder()
some_build = _create_build(branch, platform, builder)
some_result = TestResult.get_or_insert_from_parsed_json('some-test', some_build, 50)
some_test = Test.update_or_insert('some-test', branch, platform)
other_build = _create_build(branch, platform, builder, 'other-build')
other_result = TestResult.get_or_insert_from_parsed_json('other-test', other_build, 30)
other_test = Test.update_or_insert('other-test', branch, platform)
self.assertOnlyInstances([some_result, other_result])
self.assertNotEqual(some_result.key(), other_result.key())
self.assertOnlyInstances([some_test, other_test])
self.assertRaises(AssertionError, some_test.merge, (some_test))
self.assertOnlyInstances([some_test, other_test])
some_test.merge(other_test)
results_for_some_test = TestResult.all()
results_for_some_test.filter('name =', 'some-test')
results_for_some_test = results_for_some_test.fetch(5)
self.assertEqual(len(results_for_some_test), 2)
self.assertEqual(results_for_some_test[0].name, 'some-test')
self.assertEqual(results_for_some_test[1].name, 'some-test')
if results_for_some_test[0].value == 50:
self.assertEqual(results_for_some_test[1].value, 30)
else:
self.assertEqual(results_for_some_test[1].value, 50)
示例2: post
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def post(self):
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
log_id = int(self.request.get('id', 0))
log = ReportLog.get_by_id(log_id)
if not log or not log.commit:
self.response.out.write("Not processed")
return
branch = log.branch()
platform = log.platform()
build = Build.get_or_insert_from_log(log)
for test_name, result in log.results().iteritems():
test = Test.update_or_insert(test_name, branch, platform)
TestResult.get_or_insert_from_parsed_json(test_name, build, result)
schedule_runs_update(test.id, branch.id, platform.id)
log = ReportLog.get(log.key())
log.delete()
# We need to update dashboard and manifest because they are affected by the existance of test results
schedule_dashboard_update()
schedule_manifest_update()
self.response.out.write('OK')
示例3: test_replace_to_change_test_name_overrides_conflicting_result
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def test_replace_to_change_test_name_overrides_conflicting_result(self):
branch, platform, builder = _create_some_builder()
build = _create_build(branch, platform, builder)
self.assertThereIsNoInstanceOf(TestResult)
result = TestResult.get_or_insert_from_parsed_json('some-test', build, 20)
self.assertOnlyInstance(result)
conflicting_result = TestResult.get_or_insert_from_parsed_json('other-test', build, 10)
new_result = result.replace_to_change_test_name('other-test')
self.assertNotEqual(result, new_result)
self.assertOnlyInstance(new_result)
self.assertEqual(new_result.name, 'other-test')
self.assertEqual(TestResult.get(conflicting_result.key()).value, 20)
示例4: post
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def post(self):
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
log_id = int(self.request.get('id', 0))
log = ReportLog.get_by_id(log_id)
if not log or not log.commit:
self.response.out.write("Not processed")
return
branch = log.branch()
platform = log.platform()
build = Build.get_or_insert_from_log(log)
for test_name, result_value in log.results().iteritems():
unit = result_value.get('unit') if isinstance(result_value, dict) else None
test = Test.update_or_insert(test_name, branch, platform, unit)
result = TestResult.get_or_insert_from_parsed_json(test_name, build, result_value)
if not result:
continue
runs = Runs.get_by_objects(branch, platform, test)
regenerate_runs = True
if runs:
runs.update_incrementally(build, result)
regenerate_runs = False
schedule_runs_update(test.id, branch.id, platform.id, regenerate_runs)
log = ReportLog.get(log.key())
log.delete()
# We need to update dashboard and manifest because they are affected by the existance of test results
schedule_dashboard_update()
schedule_manifest_update()
self.response.out.write('OK')
示例5: test_get_or_insert_value
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def test_get_or_insert_value(self):
branch, platform, builder = _create_some_builder()
build = _create_build(branch, platform, builder)
self.assertThereIsNoInstanceOf(TestResult)
result = TestResult.get_or_insert_from_parsed_json('some-test', build, 50)
self.assertOnlyInstance(result)
self.assertEqual(result.name, 'some-test')
self.assertEqual(result.build.key(), build.key())
self.assertEqual(result.value, 50.0)
self.assertEqual(result.valueMedian, None)
self.assertEqual(result.valueStdev, None)
self.assertEqual(result.valueMin, None)
self.assertEqual(result.valueMax, None)
示例6: test_get_or_insert_stat_value
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def test_get_or_insert_stat_value(self):
branch, platform, builder = _create_some_builder()
build = _create_build(branch, platform, builder)
self.assertThereIsNoInstanceOf(TestResult)
result = TestResult.get_or_insert_from_parsed_json('some-test', build,
{"avg": 40, "median": "40.1", "stdev": 3.25, "min": 30.5, "max": 45})
self.assertOnlyInstance(result)
self.assertEqual(result.name, 'some-test')
self.assertEqual(result.build.key(), build.key())
self.assertEqual(result.value, 40.0)
self.assertEqual(result.valueMedian, 40.1)
self.assertEqual(result.valueStdev, 3.25)
self.assertEqual(result.valueMin, 30.5)
self.assertEqual(result.valueMax, 45)
示例7: test_replace_to_change_test_name
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def test_replace_to_change_test_name(self):
branch, platform, builder = _create_some_builder()
build = _create_build(branch, platform, builder)
self.assertThereIsNoInstanceOf(TestResult)
result = TestResult.get_or_insert_from_parsed_json('some-test', build, 50)
self.assertOnlyInstance(result)
self.assertEqual(result.name, 'some-test')
new_result = result.replace_to_change_test_name('other-test')
self.assertNotEqual(result, new_result)
self.assertOnlyInstance(new_result)
self.assertEqual(new_result.name, 'other-test')
self.assertEqual(new_result.build.key(), result.build.key())
self.assertEqual(new_result.value, result.value)
self.assertEqual(new_result.valueMedian, None)
self.assertEqual(new_result.valueStdev, None)
self.assertEqual(new_result.valueMin, None)
self.assertEqual(new_result.valueMax, None)
示例8: test_get_or_insert_stat_value_with_values
# 需要导入模块: from models import TestResult [as 别名]
# 或者: from models.TestResult import get_or_insert_from_parsed_json [as 别名]
def test_get_or_insert_stat_value_with_values(self):
branch, platform, builder = _create_some_builder()
build = _create_build(branch, platform, builder)
result = TestResult.get_or_insert_from_parsed_json('some-test', build,
{"avg": 40, "median": "40.1", "stdev": 3.25, "min": 30.5, "max": 45, "values": [1.0, 2.0, 3.0]})
self.assertEqual(result.values, [1.0, 2.0, 3.0])