當前位置: 首頁>>代碼示例>>Python>>正文


Python TestResult.get_or_insert_from_parsed_json方法代碼示例

本文整理匯總了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)
開發者ID:,項目名稱:,代碼行數:32,代碼來源:

示例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')
開發者ID:,項目名稱:,代碼行數:29,代碼來源:

示例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)
開發者ID:,項目名稱:,代碼行數:17,代碼來源:

示例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')
開發者ID:rniwa,項目名稱:webkit-perf,代碼行數:37,代碼來源:report_process_handler.py

示例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)
開發者ID:,項目名稱:,代碼行數:15,代碼來源:

示例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)
開發者ID:,項目名稱:,代碼行數:16,代碼來源:

示例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)
開發者ID:,項目名稱:,代碼行數:21,代碼來源:

示例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])
開發者ID:,項目名稱:,代碼行數:8,代碼來源:


注:本文中的models.TestResult.get_or_insert_from_parsed_json方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。