def METHOD_NAME(
    plugin: Type[AbstractPlugin], settings: Dict[AbstractPluginSettingsVar, str]
):
    # save copies of original global caches
    original_settings = settings_module._SETTINGS
    original_active_settings = settings_module._ACTIVE_SETTINGS
    # create new settings copy, which will be updated with the caller-specified settings
    new_settings = copy(original_settings) or Settings()
    # clear global caches
    # _ACTIVE_SETTINGS will be rehydrated on the first settings get call, so don't bother
    # to update its values
    settings_module._SETTINGS = new_settings
    settings_module._ACTIVE_SETTINGS = None
    # update the profile settings with the caller-specified settings
    new_profile_settings = new_settings.profiles[_DEFAULT_PROFILE].settings
    new_plugin_settings = new_profile_settings.get(plugin.get_path(), {})
    new_plugin_settings.update(settings)  # type: ignore
    new_profile_settings[plugin.get_path()] = new_plugin_settings
    try:
        yield settings
    finally:
        # reinstate original copies of global caches
        settings_module._SETTINGS = original_settings
        settings_module._ACTIVE_SETTINGS = original_active_settings