def invoke_sub(self): bundle = generate_combined_bundle(self.args.serial, self.args.result_id) try: print DocumentIO.dumps(bundle) except IOError: pass
def invoke_sub(self): bundle = generate_combined_bundle(self.args.serial, self.args.result_id) try: print DocumentIO.dumps(bundle) except IOError: pass
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)
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)
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)
def invoke_sub(self): PATTERN = None if self.args.parse_regex: PATTERN = self.args.parse_regex test_name = 'custom' inst = AndroidTestInstaller() run = AndroidTestRunner() parser = AndroidTestParser(pattern=PATTERN) test = AndroidTest(testname=test_name, installer=inst, runner=run, parser=parser) test.parser.results = {'test_results': []} test.setadb(self.adb) bundle = generate_combined_bundle(self.args.serial, self.args.result_id, test=test) try: print DocumentIO.dumps(bundle) except IOError: pass
def invoke_sub(self): PATTERN = None if self.args.parse_regex: PATTERN = self.args.parse_regex test_name = 'custom' inst = AndroidTestInstaller() run = AndroidTestRunner() parser = AndroidTestParser(pattern=PATTERN) test = AndroidTest(testname=test_name, installer=inst, runner=run, parser=parser) test.parser.results = {'test_results': []} test.setadb(self.adb) bundle = generate_combined_bundle(self.args.serial, self.args.result_id, test=test) try: print DocumentIO.dumps(bundle) except IOError: pass
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")
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") job_name = urllib2.quote(job_name.encode('utf-8')) try: result = dashboard.put_ex(json_bundle, job_name, stream) 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")
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)
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)
def test_dumps_produces_readable_ouptut(self): observed_text = DocumentIO.dumps(self.doc, human_readable=True) self.assertEqual(observed_text, self.expected_readable_text)
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)
def test_dumps_produces_readable_ouptut(self): observed_text = DocumentIO.dumps(self.doc, human_readable=True) self.assertEqual(observed_text, self.expected_readable_text)