def test_custom_declared_chain_configuration(project_dir, write_project_file):
    ini_contents = "\n".join(
        ("[populus]", "project_dir={project_dir}", "", "[chain:mainnet]", "provider=web3.providers.rpc.RPCProvider")
    ).format(project_dir=project_dir)
    write_project_file("populus.ini", ini_contents)

    config = load_config(get_config_paths(project_dir, []))

    assert config.chains["mainnet"]["provider"] == "web3.providers.rpc.RPCProvider"
def test_chains_property(project_dir, write_project_file):
    ini_contents = "\n".join(
        ("[populus]", "project_dir={project_dir}", "", "[chain:local]", "provider=web3.providers.ipc.IPCProvider")
    ).format(project_dir=project_dir)
    write_project_file("populus.ini", ini_contents)

    config = load_config(get_config_paths(project_dir, []))

    assert "local" in config.chains
예제 #3
0
def test_loading_single_config_file(project_dir, write_project_file):
    ini_contents = '\n'.join((
        "[populus]",
        "project_dir={project_dir}",
    )).format(project_dir=project_dir)
    write_project_file('populus.ini', ini_contents)

    config = load_config(get_config_paths(project_dir, []))

    assert config.get('populus', 'project_dir') == project_dir
def test_is_external_converts_to_boolean(project_dir, write_project_file):
    ini_contents = '\n'.join((
        "[chain:parity]",
        "is_external=true",
    )).format(project_dir=project_dir)
    write_project_file('populus.ini', ini_contents)

    config = load_config(get_config_paths(project_dir, []))

    assert config.chains['parity']['is_external'] is True
def test_loading_single_config_file(project_dir, write_project_file):
    ini_contents = '\n'.join((
        "[populus]",
        "project_dir={project_dir}",
    )).format(project_dir=project_dir)
    write_project_file('populus.ini', ini_contents)

    config = load_config(get_config_paths(project_dir, []))

    assert config.get('populus', 'project_dir') == project_dir
예제 #6
0
    def load_config(self, config_file_paths=None):
        self._config_file_paths = config_file_paths

        if not config_file_paths:
            config_file_paths = get_config_paths(os.getcwd())
        else:
            self.primary_config_file_path = config_file_paths[0]

        if is_string(config_file_paths):
            config_file_paths = [config_file_paths]

        self.config = load_config(config_file_paths)
def test_chains_property(project_dir, write_project_file):
    ini_contents = '\n'.join((
        "[populus]",
        "project_dir={project_dir}",
        "",
        "[chain:local]",
        "provider=web3.providers.ipc.IPCProvider",
    )).format(project_dir=project_dir)
    write_project_file('populus.ini', ini_contents)

    config = load_config(get_config_paths(project_dir, []))

    assert 'local' in config.chains
def test_custom_declared_chain_configuration(project_dir, write_project_file):
    ini_contents = '\n'.join((
        "[populus]",
        "project_dir={project_dir}",
        "",
        "[chain:mainnet]",
        "provider=web3.providers.rpc.RPCProvider",
    )).format(project_dir=project_dir)
    write_project_file('populus.ini', ini_contents)

    config = load_config(get_config_paths(project_dir, []))

    assert config.chains['mainnet'][
        'provider'] == 'web3.providers.rpc.RPCProvider'
예제 #9
0
def test_loading_multiple_config_files(project_dir, write_project_file):
    primary_ini_contents = '\n'.join((
        "[populus]",
        "project_dir={project_dir}",
    )).format(project_dir=project_dir)

    write_project_file('populus.ini', primary_ini_contents)

    other_ini_contents = '\n'.join((
        "[populus]",
        "project_dir=/should-not-override/",
    )).format(project_dir=project_dir)

    write_project_file('./subdir/populus.ini', other_ini_contents)

    config = load_config(
        get_config_paths(
            project_dir,
            [os.path.join(project_dir, 'subdir')],
        ))

    assert config.get('populus', 'project_dir') == project_dir
def test_loading_multiple_config_files(project_dir, write_project_file):
    primary_ini_contents = '\n'.join((
        "[populus]",
        "project_dir={project_dir}",
    )).format(project_dir=project_dir)

    write_project_file('populus.ini', primary_ini_contents)

    other_ini_contents = '\n'.join((
        "[populus]",
        "project_dir=/should-not-override/",
    )).format(project_dir=project_dir)

    write_project_file('./subdir/populus.ini', other_ini_contents)


    config = load_config(get_config_paths(
        project_dir,
        [os.path.join(project_dir, 'subdir')],
    ))

    assert config.get('populus', 'project_dir') == project_dir
def test_mainnet_chain_config_defaults(project_dir):
    config = load_config(get_config_paths(project_dir, []))

    assert "mainnet" in config.chains
def test_testing_chain_config_defaults(project_dir):
    config = load_config(get_config_paths(project_dir, []))

    assert "testrpc" in config.chains
def test_mainnet_chain_config_defaults(project_dir):
    config = load_config(get_config_paths(project_dir, []))

    assert 'mainnet' in config.chains
def test_testing_chain_config_defaults(project_dir):
    config = load_config(get_config_paths(project_dir, []))

    assert 'testrpc' in config.chains