Пример #1
0
def test_dotenv_imports(config, testproject, env_file,
                        project_settings_with_dotenv):
    config_path = _get_data_folder().joinpath("brownie-config.yaml")
    _load_config(config_path)
    testproject.load_config()
    assert config.settings["console"]["show_colors"] == False  # noqa: E712
    assert config.settings["networks"]["development"][
        "default_balance"] == "42 miliether"
Пример #2
0
def test_load_yaml_before_json(tmp_path):
    with pytest.raises(ValueError):
        _load_config(tmp_path)
    with tmp_path.joinpath("brownie-config.json").open("w") as fp:
        fp.write("""{"foo":"json"}""")
    assert _load_config(tmp_path) == {"foo": "json"}
    with tmp_path.joinpath("brownie-config.yaml").open("w") as fp:
        fp.write("""{"foo":"yaml"}""")
    assert _load_config(tmp_path) == {"foo": "yaml"}
Пример #3
0
def test_load_project_cmd_settings(config, testproject, settings_proj):
    """Tests if project specific cmd_settings update the network config when a project is loaded"""
    # get raw cmd_setting config data from the network-config.yaml file
    config_path_network = _get_data_folder().joinpath("network-config.yaml")
    cmd_settings_network_raw = _load_config(config_path_network)["development"][0]["cmd_settings"]

    # compare the manually loaded network cmd_settings to the cmd_settings in the CONFIG singleton
    cmd_settings_config = config.networks["development"]["cmd_settings"]
    for k, v in cmd_settings_config.items():
        if k != "port":
            assert cmd_settings_network_raw[k] == v

    # Load the project with its project specific settings and assert that the CONFIG was updated
    testproject.load_config()
    cmd_settings_config = config.networks["development"]["cmd_settings"]
    for k, v in settings_proj["cmd_settings"].items():
        if k != "port":
            assert cmd_settings_config[k] == v