#NEWLINE# def _parse_input( testfile ) : #NEWLINE# #INDENT# '\n  Extract the dictionary from the input file\n  ' #NEWLINE# ext = os . path . splitext ( testfile ) [ ( - 1 ) ] . lower ( ) #NEWLINE# if ( ext == '.py' ) : #NEWLINE# #INDENT# test_dic = utils . load_module ( testfile ) . test #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ext == '.json' ) : #NEWLINE# #INDENT# json_data = open ( testfile ) . read ( ) #NEWLINE# test_dic = json . loads ( json_data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . critical ( ( testfile + ' is not supported; currently only supports python and json files' ) ) #NEWLINE# raise ValueError ( 'currently only supports python and json files' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not ( len ( test_dic . keys ( ) ) == 4 ) ) : #NEWLINE# #INDENT# logger . critical ( 'input requires four fields: deployment_code, test_code, perf_code, configs_directory' ) #NEWLINE# raise ValueError ( 'input requires four fields: deployment_code, test_code, perf_code, configs_directory' ) #NEWLINE# #UNINDENT# old_valid_key_list = [ 'deployment_code' , 'test_code' , 'perf_code' , 'configs_directory' ] #NEWLINE# new_valid_key_list = [ 'deployment_code' , 'test_code' , 'dynamic_configuration_code' , 'configs_directory' ] #NEWLINE# if ( ( not ( set ( old_valid_key_list ) == set ( test_dic . keys ( ) ) ) ) and ( not ( set ( new_valid_key_list ) == set ( test_dic . keys ( ) ) ) ) ) : #NEWLINE# #INDENT# logger . critical ( 'input requires four fields: deployment_code, test_code, dynamic_configuration_code, configs_directory' ) #NEWLINE# raise ValueError ( 'input requires four fields: deployment_code, test_code, dynamic_configuration_code, configs_directory' ) #NEWLINE# #UNINDENT# filename = test_dic [ 'deployment_code' ] #NEWLINE# utils . check_file_with_exception ( filename ) #NEWLINE# filenames = test_dic [ 'test_code' ] #NEWLINE# for filename in filenames : #NEWLINE# #INDENT# utils . check_file_with_exception ( filename ) #NEWLINE# #UNINDENT# if ( 'dynamic_configuration_code' in test_dic ) : #NEWLINE# #INDENT# filename = test_dic [ 'dynamic_configuration_code' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# filename = test_dic [ 'perf_code' ] #NEWLINE# #UNINDENT# utils . check_file_with_exception ( filename ) #NEWLINE# dirname = test_dic [ 'configs_directory' ] #NEWLINE# utils . check_dir_with_exception ( dirname ) #NEWLINE# return test_dic