Closed Robinlovelace closed 2 years ago
The rOpeSci book on "HTTP Testing" has been recently updated, along with lots of the accompanying packages, to help exactly these kinds of issues. It's now much easier than it used to be to use those packages to generate mock HTTP data for tests.
That is a really useful resource that goes beyond r-pkgs, many thanks Mark! One question: is there a way to test if packages are 'graceful' without turning off Wifi? That's what I've just done to inform the commit above (finally tests pass when offline!), but seems like a bit of a drastic intervention to test what could be tested, e.g. with something like this:
devtools::check(has_internet = FALSE)
One for the devtools issue tracker? Sure this would be of use to others.
Hi @mpadge and thank you very much for the link. I will read it as soon as possible since I may also have similar problems with CRAN checks.
You can use curl::curl_fetch_memory
to trace all curl
calls, like the way I still do it in osmdata
. Basic procedure is:
myval <- NULL
trace(
curl::curl_fetch_memory,
exit = function() {
myval <<- returnValue()
}
)
# do whatever, and watch all actual calls appear
untrace (curl::curl_fetch_memory)
Between trace
and untrace
, you do your stuff (run tests, example, whatever), and every external call will appear. What you want is for nothing to appear when you run tests/examples, which means that you're not actually making any external calls.
Dear maintainer,
Please see the problems shown on https://cran.r-project.org/web/checks/check_results_stplanr.html.
Please correct before 2021-10-21 to safely retain your package on CRAN.
It seems we need to remind you of the CRAN policy:
'Packages which use Internet resources should fail gracefully with an informative message if the resource is not available or has changed (and not give a check warning nor error).'
This needs correction whether or not the resource recovers.
The CRAN Team
Aim: test without internet connection.