示例#1
0
def test_configuration_file_saved_retrieved(correct_arguments, 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 tada_configuration_dict[
        configuration.DIRECTORY] == correct_arguments[1]
    assert configuration.get_directory(
        tada_configuration_dict) == correct_arguments[1]
示例#2
0
    from tada.util import run
    from tada.util import save
except ImportError:
    from util import configuration
    from util import constants
    from util import generate
    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