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 check failing #151

Open
brunj7 opened this issue Jul 31, 2024 · 4 comments
Open

CRAN check failing #151

brunj7 opened this issue Jul 31, 2024 · 4 comments
Assignees

Comments

@brunj7
Copy link
Collaborator

brunj7 commented Jul 31, 2024

Dear maintainer,

Please see the problems shown on
https://cran.r-project.org/web/checks/check_results_metajam.html.

Please correct before 2024-08-19 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

@brunj7 brunj7 self-assigned this Jul 31, 2024
@brunj7
Copy link
Collaborator Author

brunj7 commented Jul 31, 2024

For the record, the current failure is

── Error ('test-download_ISO_data.R:15:3'): test data URL with ISO
metadata from Research Workspace member node and with multiple data
tables ──
Error in h(simpleError(msg, call)): error in evaluating the
argument 'x' in selecting a method for function 'resolve': Timeout was
reached: [cn.dataone.org] Connection timeout after 10001 ms
Backtrace:

1. ├─metajam:::download_ISO_data(...) at test-download_ISO_data.R:15:3
2. │ ├─dataone::resolve(dataone::CNode("PROD"), data_id)
3. │ ├─dataone::CNode("PROD")
4. │ └─dataone::CNode("PROD")
5. │ └─dataone (local) .local(x, ...)
6. │ └─httr::GET(CN_URI)
7. │ └─httr:::request_perform(req, hu$handle$handle)
8. │ ├─httr:::request_fetch(req$output, req$url, handle)
9. │ └─httr:::request_fetch.write_memory(req$output,
req$url, handle)
10. │ └─curl::curl_fetch_memory(url, handle = handle)
11. └─base::.handleSimpleError(...)
12. └─base (local) h(simpleError(msg, call))

--
Brian D. Ripley, [email protected]
Emeritus Professor of Applied Statistics, University of Oxford

@brunj7
Copy link
Collaborator Author

brunj7 commented Jul 31, 2024

Jenny's inputs:

I have lots of thoughts and strategies around this, but the TL;DR really is that I include skip_if_offline() in tests that should not run w/o internet access.
And skip_if_offline() also skips on CRAN.
https://github.com/tidyverse/googledrive/blob/ed574d9eb3308619fc3e735251bfd42e6cfdb8e2/tests/testthat/test-drive_cp.R#L30C3-L30C20
https://testthat.r-lib.org/reference/skip.html
testthat.r-lib.orgtestthat.r-lib.org
Skip a test — skip
skip_if() and skip_if_not() allow you to skip tests, immediately
concluding a test_that() block without executing any further expectations.
This allows you to skip a test without failure, if for some reason it
can't be run (e.g. it depends on the feature of a specific operating system,
or it requires a specific version of a package).
Show more
https://testthat.r-lib.org/reference/skip.html

One of the testing chapters in R Packages also has a lot of relevant content. Which basically boils down to some version of the above advice and some version of what you are already doing, in case that makes it feel better!
https://r-pkgs.org/testing-advanced.html#when-testing-gets-hard
https://r-pkgs.org/testing-advanced.html#special-considerations-for-cran-packages

And you can specify a host, which makes it feel (and maybe even be?) more authentic. I do that somewhere, but I guess not in the example above.

@brunj7
Copy link
Collaborator Author

brunj7 commented Jul 31, 2024

Lluis:
There is a book about this topic https://books.ropensci.org/http-testing/ in the case of vignettes an approach is to precompute them. You could also use a prerecorded request but that is more complicated.

@brunj7
Copy link
Collaborator Author

brunj7 commented Jul 31, 2024

Nicholas:

I wrote the rnassqs package, which is a wrapper around an API and benefited quite a lot from review by the Neal Richardson, the author of the httptest package. You might look at the test structure there for an example. The setup gets things going with mock API calls, and then the actual tests are mostly in test-request. Although the tests are a few years old so they may not match current best practices.

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

1 participant