def GetTestDataSeries(test_data_path): """Get metadata from json files at |test_data_path|. Returns: A list of CBuildbotMetadata objects, sorted by their start time. """ filenames = glob.glob(os.path.join(test_data_path, '*.json')) metadatas = [] for fname in filenames: metadatas.append( metadata_lib.CBuildbotMetadata.FromJSONString(osutils.ReadFile(fname))) # Convert start time values, which are stored in RFC 2822 string format, # to seconds since epoch. timestamp_from_dict = lambda x: cros_build_lib.ParseUserDateTimeFormat( x.GetDict()['time']['start']) metadatas.sort(key=timestamp_from_dict) return metadatas
def testParseUserDateTimeFormat(self): stringtime = cros_build_lib.UserDateTimeFormat(100000.0) self.assertEqual(cros_build_lib.ParseUserDateTimeFormat(stringtime), 100000.0)