import pathlib


def missing_options_file(tmpdir, request):
    """Return a path to an config file that is
    valid, but missing expected options (commented
    out below).
    Remove the file when a test is finished with it.
    """
    data_dir = pathlib.Path(str(tmpdir))
    missing_options_file = data_dir.joinpath('invalid')
    with missing_options_file.open('w') as f:
        f.write(
            '[gui]\n'
            # + 'message_duration = 5\n'
            + 'gui_welcome_label = Welcome to the STEM Learning Center!\n'
            # + 'full_user_names = True\n'
            + 'large_font_size = 30\n'
            + 'medium_font_size = 18\n'
            + 'small_font_size = 15\n'
            + 'tiny_font_size = 10\n'
        )

    def tearDown():
        if missing_options_file.exists():
            missing_options_file.unlink()

    request.addfinalizer(tearDown)
    return missing_options_file