import toml


def toml_files(tmp_path):
    """Generate TOML config files for testing."""

    def gen_toml_files(files={'test.toml': {'sec': {'key': 'val'}}}):
        f_path = None
        for name, config in files.items():
            f_path = tmp_path / name
            with open(f_path, 'w') as f:
                toml.dump(config, f)

        if len(files) == 1:
            return f_path
        return tmp_path

    return gen_toml_files