#NEWLINE# def get_tests_run_dicts_from_run_id( run_id , session = None ) : #NEWLINE# #INDENT# "Returns all the stored data about test runs for a specific run.\n\n    This method returns a dictionary containing all the information stored in\n    the database regarding the test_runs. This includes the test_id from the\n    tests table, all the stored key value pair metadata from the\n    test_run_metadata table, and from the test_runs table the status,\n    start_time, and stop_time.\n\n    :param str run_id: The run's uuid (the id column in the run table) which to\n                       use to select it's run ids to collect information for.\n    :param session: optional session object if one isn't provided a new session\n\n    :return dict: A dictionary with the test_id from the tests for keys that\n                  contains all the stored information about the test_runs.\n    " #NEWLINE# session = ( session or get_session ( ) ) #NEWLINE# query = db_utils . model_query ( models . Test , session = session ) . join ( models . TestRun , ( models . Test . id == models . TestRun . test_id ) ) . join ( models . Run , ( models . TestRun . run_id == models . Run . id ) ) . filter ( ( models . Run . uuid == run_id ) ) . outerjoin ( models . TestRunMetadata , ( models . TestRun . id == models . TestRunMetadata . test_run_id ) ) . order_by ( models . TestRun . start_time , models . TestRun . start_time_microsecond ) . values ( models . Test . test_id , models . TestRun . status , models . TestRun . start_time , models . TestRun . start_time_microsecond , models . TestRun . stop_time , models . TestRun . stop_time_microsecond , models . TestRunMetadata . key , models . TestRunMetadata . value ) #NEWLINE# test_runs = collections . OrderedDict ( ) #NEWLINE# for test_run in query : #NEWLINE# #INDENT# if ( test_run [ 0 ] not in test_runs ) : #NEWLINE# #INDENT# if test_run [ 2 ] : #NEWLINE# #INDENT# start_time = test_run [ 2 ] #NEWLINE# start_time = start_time . replace ( microsecond = test_run [ 3 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# start_time = None #NEWLINE# #UNINDENT# if test_run [ 4 ] : #NEWLINE# #INDENT# stop_time = test_run [ 4 ] #NEWLINE# stop_time = stop_time . replace ( microsecond = test_run [ 5 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stop_time = None #NEWLINE# #UNINDENT# test_runs [ test_run [ 0 ] ] = { #NEWLINE# #INDENT# 'status' : test_run [ 1 ] , #NEWLINE# 'start_time' : start_time , #NEWLINE# 'stop_time' : stop_time , #NEWLINE# #UNINDENT# } #NEWLINE# if test_run [ 6 ] : #NEWLINE# #INDENT# test_runs [ test_run [ 0 ] ] [ 'metadata' ] = { #NEWLINE# #INDENT# test_run [ 6 ] : test_run [ 7 ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if test_run [ 6 ] : #NEWLINE# #INDENT# test_runs [ test_run [ 0 ] ] [ 'metadata' ] [ test_run [ 6 ] ] = test_run [ 7 ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return test_runs