R Under development (unstable) (2024-05-12 r86534 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library("testthat") > library("devtools") Loading required package: usethis Attaching package: 'devtools' The following object is masked from 'package:testthat': test_file > 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 (identical(Sys.getenv("NOT_CRAN"), "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") + } Using Dataverse server `demo.dataverse.org`. [ FAIL 0 | WARN 0 | SKIP 35 | PASS 3 ] ══ Skipped tests (35) ══════════════════════════════════════════════════════════ • On CRAN (35): 'tests-dataset_files.R:6:3', 'tests-dataset_metadata.R:6:3', 'tests-dataset_metadata.R:19:3', 'tests-dataverse_contents.R:5:3', 'tests-dataverse_contents.R:15:3', 'tests-get_dataframe-dataframe-basketball.R:6:3', 'tests-get_dataframe-dataframe-basketball.R:21:3', 'tests-get_dataframe-dataframe-basketball.R:35:3', 'tests-get_dataframe-dataframe-basketball.R:49:3', 'tests-get_dataframe-original-basketball.R:21:3', 'tests-get_dataframe-original-basketball.R:57:3', 'tests-get_dataframe-original-basketball.R:79:3', 'tests-get_dataframe-original-basketball.R:101:3', 'tests-get_dataframe-original-basketball.R:121:3', 'tests-get_dataframe-original-basketball.R:140:3', 'tests-get_dataset.R:6:3', 'tests-get_dataverse.R:5:3', 'tests-get_dataverse.R:19:3', 'tests-get_file.R:6:3', 'tests-get_file.R:17:3', 'tests-get_file.R:27:3', 'tests-get_file.R:42:3', 'tests-get_file.R:53:3', 'tests-get_file_metadata.R:6:3', 'tests-get_file_metadata.R:17:3', 'tests-get_url.R:3:3', 'tests-list_datasets.R:5:3', 'tests-list_datasets.R:34:3', 'tests-search.R:2:3', 'tests-search.R:7:3', 'tests-search.R:12:3', 'tests-search.R:17:3', 'tests-search.R:22:3', 'tests-search.R:27:3', 'tests-search.R:32:3' [ FAIL 0 | WARN 0 | SKIP 35 | PASS 3 ] > > proc.time() user system elapsed 1.60 0.32 1.92