def main(): with open(FLAGS.input_csv_file, 'r') as csvfile: csv_reader = csv.reader(csvfile) timestamp, stat_entries = get_data_from_csv(csv_reader) benchmark_util.store_data_in_json( stat_entries, timestamp, output_file=FLAGS.output_json_file, test_name=FLAGS.test_name)
def testStoreDataWithNoEntries(self): with tempfile.NamedTemporaryFile() as temp_file: timing_entries = [] benchmark_util.store_data_in_json( timing_entries, datetime.date(2017, 1, 1), temp_file.name) with open(temp_file.name, 'r') as json_file: json_output = json.loads(json_file.read()) self.assertEqual('TestBenchmark', json_output['name']) self.assertEqual(u'1483228800', json_output['startTime'])
def testStoreDataWithNoEntries(self): with tempfile.NamedTemporaryFile() as temp_file: timing_entries = [] benchmark_util.store_data_in_json(timing_entries, datetime.date(2017, 1, 1), temp_file.name) json_output = json.loads(open(temp_file.name, 'r').read()) self.assertEquals('TestBenchmark', json_output['name']) self.assertEquals(u'1483228800', json_output['startTime'])
def testStoreDataWithEntries(self): with tempfile.NamedTemporaryFile() as temp_file: timing_entries = [benchmark_util.StatEntry('test', 0.1, 1)] benchmark_util.store_data_in_json( timing_entries, datetime.date(2017, 1, 1), temp_file.name) with open(temp_file.name, 'r') as json_file: json_output = json.loads(json_file.read()) self.assertEqual(1, len(json_output['entries']['entry'])) self.assertEqual('test', json_output['entries']['entry'][0]['name']) self.assertEqual(0.1, json_output['entries']['entry'][0]['wallTime']) self.assertEqual(u'1', json_output['entries']['entry'][0]['iters']) self.assertEqual(u'1483228800', json_output['startTime']) self.assertEqual('TestBenchmark', json_output['name'])
def testStoreDataWithEntries(self): with tempfile.TemporaryFile() as temp_file: timing_entries = [benchmark_util.StatEntry('test', 0.1, 1)] benchmark_util.store_data_in_json(timing_entries, datetime.date(2017, 1, 1), temp_file.name) json_output = json.loads(open(temp_file.name, 'r').read()) self.assertEquals(1, len(json_output['entries']['entry'])) self.assertEquals('test', json_output['entries']['entry'][0]['name']) self.assertEquals(0.1, json_output['entries']['entry'][0]['wallTime']) self.assertEquals(u'1', json_output['entries']['entry'][0]['iters']) self.assertEquals(u'1483228800', json_output['startTime']) self.assertEquals('TestBenchmark', json_output['name'])