Ejemplo n.º 1
0
def initialize(config, plugins, full_config):
    logging.info("[TEST PLUGIN] Initializing plugin")
    plugins = register_plugin_function(PluginHook.post_config, sample_function,
                                       config, plugins)
    plugins = register_plugin_function(PluginHook.post_build_context,
                                       contexted_function, config, plugins)
    return plugins
Ejemplo n.º 2
0
def initialize(config, plugins, full_config):
    logging.info("[Sensitivity Plugin] Initializing plugin")
    plugins = register_plugin_function(PluginHook.post_config, generate_sensitivity_runs, config,
                                       plugins)
    plugins = register_plugin_function(PluginHook.post_build_context, post_build_context_apply_factors, config, plugins)
    plugins = register_plugin_function(PluginHook.post_build_context,
                                       post_build_context_apply_static_factors, config, plugins)
    return plugins
Ejemplo n.º 3
0
def test_register_twice():
    plugins = {}
    plugins1 = {}
    plugins2 = {}
    plugins1 = register_plugin_function(PluginHook.analyze_file, sample_function, {}, plugins)
    plugins2 = register_plugin_function(
        PluginHook.analyze_file, sample_function, {"a": 1}, plugins1
    )
    assert plugins1 == {PluginHook.analyze_file: [{"fun": sample_function, "config": {}}]}
    assert plugins1 == plugins2
Ejemplo n.º 4
0
def initialize(config, plugins, full_config):
    logging.info("[SIMPLE WEATHER FORECAST PLUGIN] Initializing plugin")
    config["weatherDir"] = full_config["weatherDir"]
    config["start_date"] = pythia.util.to_julian_date(
        pythia.util.from_iso_date(config["start_date"]))
    config["end_date"] = pythia.util.to_julian_date(
        pythia.util.from_iso_date(config["end_date"]))
    config["start_on"] = config["start_date"][2:5]
    config["end_on"] = config["end_date"][2:5]
    return register_plugin_function(PluginHook.post_build_context,
                                    construct_pixel_forecast, config, plugins)
Ejemplo n.º 5
0
def test_register_with_invalid_fun():
    plugins = {}
    plugins1 = register_plugin_function(PluginHook.analyze_file, "not a function", "", plugins)
    assert plugins1 == {}
Ejemplo n.º 6
0
def test_register_properly():
    plugins = {}
    plugins1 = {}
    plugins1 = register_plugin_function(PluginHook.post_build_context, sample_function, {}, plugins)
    assert plugins1 == {PluginHook.post_build_context: [{"fun": sample_function, "config": {}}]}
Ejemplo n.º 7
0
def test_register_with_invalid_hook():
    plugins = {}
    plugins1 = register_plugin_function("false_hook", "not a function", "", plugins)
    assert plugins1 == {}
Ejemplo n.º 8
0
def test_register_with_invalid_config():
    plugins = {}
    plugins1 = register_plugin_function(PluginHook.post_analysis, sample_function, "", plugins)
    assert plugins1 == {}