示例#1
0
def test_get_everviz_folder(tmpdir, mocked_api):
    everest_folder = "everest_output"
    expected_everviz_path = os.path.join(everest_folder, "everviz")
    with tmpdir.as_cwd():
        assert not os.path.exists(expected_everviz_path)
        everviz_path = get_everviz_folder(mocked_api)
        assert os.path.exists(everviz_path)
        assert expected_everviz_path == everviz_path
示例#2
0
def test_set_up_data_sources(tmpdir, mocked_api):
    expected = DataSources(
        controls_per_batch="everest_output/everviz/controls_per_batch.csv",
        controls_initial_vs_best=
        "everest_output/everviz/controls_initial_vs_best.csv",
    )

    with tmpdir.as_cwd():
        for field in expected._fields:
            assert not os.path.exists(getattr(expected, field))

        get_everviz_folder(mocked_api)
        result = _set_up_data_sources(mocked_api)
        assert expected == result

        for field in result._fields:
            assert os.path.exists(getattr(result, field))
示例#3
0
def setup_default_everviz_config(api):
    """
    Creates default everviz config file and all required data sources
    """
    everviz_folder = get_everviz_folder(api)

    config = webviz_config(api)
    config_file_path = os.path.join(everviz_folder, DEFAULT_CONFIG)
    write_webviz_config(config, config_file_path)
    logger.info("Default everviz config created: {}".format(config_file_path))
    return config_file_path
示例#4
0
def page_layout(api):
    everviz_path = get_everviz_folder(api)
    config_path = os.path.join(everviz_path, DEFAULT_CONFIG)
    return {
        "title": "Config editor",
        "content": [
            {
                "ConfigEditor": {
                    "data_path": config_path,
                },
            },
        ],
    }