def test_read_yaml_toml_json_config(dl1_image_file, config_files): """check that we can read multiple formats of config file""" tool = ProcessorTool() for config_base in config_files: config = resource_file(config_base) tool.load_config_file(config) tool.config.EventSource.input_url = dl1_image_file tool.config.DataWriter.overwrite = True tool.setup() assert (tool.get_current_config()["ProcessorTool"]["DataWriter"] ["contact_info"].name == "YOUR-NAME-HERE")
def test_multiple_configs(dl1_image_file): """ensure a config file loaded later overwrites keys from an earlier one""" tool = ProcessorTool() tool.load_config_file(resource_file("base_config.yaml")) tool.load_config_file(resource_file("stage2_config.yaml")) tool.config.EventSource.input_url = dl1_image_file tool.config.DataWriter.overwrite = True tool.setup() # ensure the overwriting works (base config has this option disabled) assert (tool.get_current_config()["ProcessorTool"]["DataWriter"] ["write_showers"] is True)