Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRAN message on internet resources #469

Closed
Robinlovelace opened this issue Oct 12, 2021 · 4 comments
Closed

CRAN message on internet resources #469

Robinlovelace opened this issue Oct 12, 2021 · 4 comments

Comments

@Robinlovelace
Copy link
Member

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.

@mpadge
Copy link
Member

mpadge commented Oct 12, 2021

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.

@Robinlovelace
Copy link
Member Author

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.

@agila5
Copy link
Collaborator

agila5 commented Oct 12, 2021

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.

@mpadge
Copy link
Member

mpadge commented Oct 12, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants