from pathlib import Path
import shelve


def create_generic_shelve_file(tmpdir) -> Path:
    """
    Create and store a generic file using 'shelve' module.

    At the end of tests, this file is removed by the finalizer of the
    'tmpdir' fixture.

    Returns
    -------
    pathlib.Path
        Path of the saved file
    """
    filename = tmpdir.join("generic_shelve_file_with_string")
    my_shelf = shelve.open(str(filename), "n")  # 'n' for new
    my_shelf["shelve_data"] = "Generic File"
    my_shelf.close()
    return filename