def test_trinity_config_computed_properties_custom_xdg(tmpdir, xdg_trinity_root):
    alt_xdg_root = tmpdir.mkdir('trinity-custom')
    assert not is_under_path(alt_xdg_root, xdg_trinity_root)

    data_dir = get_data_dir_for_network_id(1, alt_xdg_root)
    trinity_config = TrinityConfig(trinity_root_dir=alt_xdg_root, network_id=1)

    assert trinity_config.network_id == 1
    assert trinity_config.data_dir == data_dir
    assert trinity_config.nodekey_path == get_nodekey_path(data_dir)
示例#2
0
文件: config.py 项目: Artabaz/trinity
    def data_dir(self) -> Path:
        """
        The data_dir is the base directory that all chain specific information
        for a given chain is stored.

        All defaults for chain directories are resolved relative to this
        directory.
        """
        if self._data_dir is not None:
            return self._data_dir
        else:
            return get_data_dir_for_network_id(self.network_id, self.trinity_root_dir)