#NEWLINE# def get_modules( testfile , tests_to_run , config_overrides ) : #NEWLINE# #INDENT# '\n  Gets modules and objects required to run tests\n\n  :param testfile:\n  :param tests_to_run:\n  :param config_overrides:\n  :return:\n  ' #NEWLINE# test_dic = _parse_input ( testfile ) #NEWLINE# ( master_config , configs ) = load_configs_from_directory ( test_dic [ 'configs_directory' ] , config_overrides ) #NEWLINE# _setup_paths ( master_config . mapping . get ( 'additional_paths' , [ ] ) ) #NEWLINE# deployment_module = utils . load_module ( test_dic [ 'deployment_code' ] ) #NEWLINE# if ( 'dynamic_configuration_code' in test_dic ) : #NEWLINE# #INDENT# perf_module = utils . load_module ( test_dic [ 'dynamic_configuration_code' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# perf_module = utils . load_module ( test_dic [ 'perf_code' ] ) #NEWLINE# #UNINDENT# test_modules = [ utils . load_module ( testcode ) for testcode in test_dic [ 'test_code' ] ] #NEWLINE# if ( tests_to_run is not None ) : #NEWLINE# #INDENT# tests = [ test for test in _determine_tests ( test_modules ) if ( test . name in tests_to_run ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tests = [ test for test in _determine_tests ( test_modules ) ] #NEWLINE# #UNINDENT# tests_with_phases = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for test in tests : #NEWLINE# #INDENT# tests_with_phases [ test . phase ] = ( tests_with_phases . get ( test . phase , [ ] ) + [ test ] ) #NEWLINE# #UNINDENT# serial_tests = tests_with_phases . pop ( constants . DEFAULT_TEST_PHASE , [ ] ) #NEWLINE# tests = ( serial_tests + [ test_with_phase [ 1 ] for test_with_phase in sorted ( tests_with_phases . items ( ) , key = ( lambda pair : pair [ 0 ] ) ) ] ) #NEWLINE# return ( deployment_module , perf_module , tests , master_config , configs )