Giter Site home page Giter Site logo

CRAN check errors about dataverse-client-r HOT 5 CLOSED

kuriwaki avatar kuriwaki commented on August 16, 2024 1
CRAN check errors

from dataverse-client-r.

Comments (5)

wibeasley avatar wibeasley commented on August 16, 2024 1
  1. Your overall point makes sense. Of all the tests in the package, this is the only one I see that doesn't depend on hitting the demo server.

    standarize_string <- function (x, start = 1, stop = nchar(x)) {

  2. I don't understand that specific error message. The value I see is "2023-01-01"

    api_token_expiration: "2023-01-01"
    , which is referenced on this line the file you linked to:
    config$api_token_expiration,
    So the message about "2023-03-10" confuses me. I don't see any other instances of "2023" in the repository today: https://github.com/search?q=repo%3AIQSS%2Fdataverse-client-r+2023&type=code

from dataverse-client-r.

wibeasley avatar wibeasley commented on August 16, 2024 1

Do you know why this part might get evaluated

No, and that's tricky to debug. It's not like we can play with different version.

I can see how CRAN changes some environmental subtly (eg, it used to be "CRAN" but now it's "cran"). But I can't see how/why something on CRAN would set "NOT_CRAN".

Oh wait, I think this comment helps:

  • skip_on_cran() skips on CRAN (using the NOT_CRAN env var set by devtools and friends).

I'm interpreting that this variable is set only if testthat/devtools is the one starting the test. So if you don't want it running on CRAN, change it to if (Sys.getenv("NOT_CRAN") == "true") {

from dataverse-client-r.

kuriwaki avatar kuriwaki commented on August 16, 2024 1

That sounds like the same as what we had (if (Sys.getenv("NOT_CRAN") %in% c("", "true"))), but this is helpful. In the dev branch in the above commit I have used identical to match it up with the testthat code, and also loaded the devtools package since from the description NOT_CRAN gets set by devtools.

I plan to re-submit it to CRAN as v.0.3.13 tomorrow. The Github Actions checks now all pass!

from dataverse-client-r.

kuriwaki avatar kuriwaki commented on August 16, 2024

For some reason the new token I got and submitted for v0.3.12 had an expiration date in March 2023, so now the tests are failing again at CRAN after only two months. CRAN gave me a deadline to fix this by March 27.

I can fix this again with a token that lasts till 2024-03-13, but I wonder if it is better to try and skip even this expiration check for CRAN, like we do for all the tests. @wibeasley what do you think? I wonder if we can put skip_on_cran() in the testthat/testthat.R root file, which is what's failing now. Even a once-a-year update now feels like a liability to keep this package on CRAN.

Log. Currently on: https://cran.r-project.org/web/checks/check_results_dataverse.html

Version: 0.3.12
Check: tests
Result: ERROR
     Running ‘testthat.R’ [1s/1s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library("testthat")
     > library("dataverse")
     >
     > if (!requireNamespace("yaml", quietly = TRUE)) {
     + warning("The 'yaml' package must be present to test the dataverse package.")
     + } else if (!requireNamespace("checkmate", quietly = TRUE)) {
     + warning("The 'checkmate' package must be present to test the dataverse package.")
     + } else {
     + server <- Sys.getenv("DATAVERSE_SERVER")
     + key <- Sys.getenv("DATAVERSE_KEY")
     +
     + if (server == "" | key == "") {
     + config <- yaml::read_yaml(system.file("constants.yml", package = "dataverse"))
     + # config <- yaml::read_yaml("inst/constants.yml")
     +
     + Sys.setenv("DATAVERSE_SERVER" = config$server)
     + Sys.setenv("DATAVERSE_KEY" = config$api_token)
     +
     + # To better identify the source of problems, check if the token is expired.
     + # This check *should* be unnecessary on CRAN, since not CRAN tests should
     + # try to access any server.
     + if (Sys.getenv("NOT_CRAN") %in% c("", "true")) {
     + if (as.Date(config$api_token_expiration) < Sys.Date()) {
     + stop(
     + "The API token expired on `",
     + config$api_token_expiration,
     + "`, so the tests would probably fail. ",
     + "Please regenerate a new token and update `inst/constants.yml`"
     + )
     + }
     + }
     + rm(config)
     + }
     + rm(server, key)
     +
     + message("Using Dataverse server `", Sys.getenv("DATAVERSE_SERVER"), "`.")
     +
     + test_check("dataverse")
     + }
     Error: The API token expired on `2023-03-10`, so the tests would probably fail. Please regenerate a new token and update `inst/constants.yml`
     Execution halted

from dataverse-client-r.

kuriwaki avatar kuriwaki commented on August 16, 2024

Thank you @wibeasley.

From the log, I think the error is coming from testthat/testthat.R

# To better identify the source of problems, check if the token is expired.
# This check *should* be unnecessary on CRAN, since not CRAN tests should
# try to access any server.
if (Sys.getenv("NOT_CRAN") %in% c("", "true")) {

rather than a specific test function. Do you know why this part might get evaluated and throw an error in CRAN's server even though we have Sys.getenv("NOT_CRAN")?

I will also put a skip_if_cran() on standardize_string(), but that function does not use any dataverse functions.

For your point 2, I think the issue is that the version on CRAN right now is the package from the dev branch, rather than master.

from dataverse-client-r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.