def test_configuration_file_correct_functions_modules(correct_arguments, correct_function, correct_module, tmpdir): """Checks that the configuration file was saved to the directory""" parsed_arguments = arguments.parse(correct_arguments) directory_prefix = str(tmpdir) + "/" configuration.save(directory_prefix + constants.CONFIGURATION, vars(parsed_arguments)) assert len(tmpdir.listdir()) == 1 tada_configuration_dict = configuration.read(directory_prefix + constants.CONFIGURATION) assert configuration.get_function( tada_configuration_dict) == correct_function assert configuration.get_module(tada_configuration_dict) == correct_module
from util import package from util import read from util import run from util import save if __name__ == "__main__": # read the configuration file to access the configuration dictionary tada_configuration_dict = configuration.read(constants.CONFIGURATION) # add the specified directory to the system path package.add_sys_path(configuration.get_directory(tada_configuration_dict)) # reflectively import the chosen module analyzed_module = importlib.import_module( configuration.get_module(tada_configuration_dict)) # reflectively access the chosen function analyzed_function = getattr( analyzed_module, configuration.get_function(tada_configuration_dict)) # read the chosen_size chosen_size = read.read_experiment_size() # configure perf runner = pyperf.Runner() # give a by-configuration name to the experiment current_experiment_name = configuration.get_experiment_name( tada_configuration_dict, chosen_size) # set the name of the experiment for perf runner.metadata[constants.DESCRIPTION_METANAME] = current_experiment_name # read the chosen types func_type = configuration.get_types(tada_configuration_dict) # initialize path for schema path = None gen_func = None # using hypothesis to generate experiment data