r-lib / testthat

An R 📦 to make testing 😀
https://testthat.r-lib.org
Other
867 stars 313 forks source link

`skip_if_offline()` complaining about missing curl package on ghactions but curl is installed #1963

Open gavinsimpson opened 1 month ago

gavinsimpson commented 1 month ago

I've started seeing this error in R CMD check runs on ghactions:

<rlib_error_package_not_found/rlang_error/error/condition>
Error in `skip_if_offline()`: The package "curl" is required.
Backtrace:
    ▆
 1. └─testthat::skip_if_offline() at test-draw-parametric-effects.R:163:3
 2.   └─rlang::check_installed("curl")

but as far as I can tell, curl is installed during the dependency resolution step of the workflow: https://github.com/gavinsimpson/gratia/actions/runs/9113727769/job/25055965022#step:8:6706

Am I missing something here?

The r-lib workflow that sets up the dependencies will install all the dependencies of testthat which includes curl - I presume that's why curl is being installed anyway. And the session_info() output I linked to suggests curl was installed OK.

I've also deleted caches to force reinstalling packages.

gavinsimpson commented 1 month ago

Hmmm, I appear to have "fixed" my issue by making my package depend on the curl package via an entry in Suggests. If this is expected behaviour that seems very odd behaviour indeed - why does my package need to depend on curl when I depend on testthat and curl is installed?

If this is the intended bevaiour, the error messag could use some work as it is ambiguous what "The package "curl" is required" actually means; does it mean my package needs to depend on it, not simply that it is installed (as implied by the check_installed() call also quoted in the error backtrace).