Skip to content

Skipping tests when API_KEY isn't set (undesirable)Β #920

@debruine

Description

@debruine

I'm developing a package that uses ellmer, and I've made a models() function that tries to run all the models_platform() functions in ellmer with a tryCatch so it only returns model lists where a valid API_KEY exists in the Renviron (without the user having to remeber what these are or me having to code in checks for them all).

The function works great, but when I try to test it using testthat, it triggers a test skip after the first attempt to get a model list for a platform I don't have an API key for, with the skipped tests message "ANTHROPIC_API_KEY env var is not configured".

I've looked briefly through the ellmer code, but can't figure out exactly where this is triggered. I can see how this would be useful for your tests to skip out any tests if an api key isn't set, but it's messing with mine.

So I'm mainly making sure you know this has a side effect on tests in packages using ellmer. I can work around it if it's not something you can/want to change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions